Java program
I made this Account.java below. Using the attached code I need help with 10.7 (Game: ATM
machine)
Use the Account class created in Programming Exercise 9.7 to simulate an ATM machine.
Create ten accounts in an array with id 0, 1, . . . , 9, and initial balance $100.
The system prompts the user to enter an id. If the id is entered incorrectly, ask the user to enter a
correct id.
Once an id is accepted, the main menu is displayed as shown in the sample run.
You can enter a choice 1 for viewing the current balance, 2 for withdrawing money, 3 for
depositing money, and 4 for exiting the main menu.
Once you exit, the system will prompt for an id again. Thus, once the system starts, it will not
stop.
*/
import java.util.Date;
public class Account {
/**
* @param args
*/
private int id=0;
private double balance=0;
private double annualIntrestRate=0;
private Date dateCreated;
public Account() {
super();
}
public Account(int id, double balance) {
super();
this.id = id;
this.balance = balance;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getAnnualIntrestRate() {
return annualIntrestRate;
}
public void setAnnualIntrestRate(double annualIntrestRate) {
this.annualIntrestRate = annualIntrestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public double getMonthlyInterestRate()
{
return (this.getAnnualIntrestRate()/12);
}
public double getMonthlyInterest()
{
return (getBalance() *getMonthlyInterestRate()/100);
}
public double withDraw(double balance)
{
this.setBalance(this.getBalance()-balance);
return this.getBalance();
}
public double diposite(double balance)
{
this.setBalance(this.getBalance()+balance);
return this.getBalance();
}
public double totalBalance()
{
balance =balance + getMonthlyInterest();
return balance;
}
}
//AccountTest.java
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
public class AccountTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
Account ac=new Account(1,5000.00);
System.out.println(\"Enter the annual intrest rate\");
double intrestRate=sc.nextDouble();
ac.setAnnualIntrestRate(intrestRate);
Date d=new Date();
Calendar currentDate = Calendar.getInstance();
ac.setDateCreated(currentDate.getTime());
System.out.println(\"Date id \"+ac.getDateCreated());
System.out.println(\"Monthly intrest rate is :\"+ac.getMonthlyInterestRate());
System.out.println(\"Monthly intrest is :\"+ac.getMonthlyInterest());
System.out.println(\"Enter Amount for diposite \");
double dipositeAmount=sc.nextDouble();
System.out.println(\"The amount after diposite is :\"+ac.diposite(dipositeAmount));
System.out.println(\"Enter Amount to withdraw :\");
double withdramount= sc.nextDouble.
I need help creating a basic and simple Java program. Here is the ex.pdfrajeshjangid1865
I need help creating a basic and simple Java program. Here is the exercise. I have included my
Account class that is referred to at the bottom, below the exercise.
Use the Account class created in Programming Exercise 9.7 to simulate an ATM machine.
Create ten accounts in an array with id 0, 1, . . . , 9, and initial balance $100. The system prompts
the user to enter an id. If the id is entered incorrectly, ask the user to enter a correct id. Once an
id is accepted, the main menu is displayed as shown in the sample run. You can enter a choice 1
for viewing the current balance, 2 for withdrawing money, 3 for depositing money, and 4 for
exiting the main menu. Once you exit, the system will prompt for an id again. Thus, once the
system starts, it will not stop. You will need to cntrl-c to stop your program; this is ok for this
assignment. If you want your program to terminate more elegantly you can add in additional
logic, but this is not required.
Please refer to textbook for sample output pg. 401.
Account.java
import java.util.Date;
public class Account {
private int id;
private double balance;
static private double annualInterestRate = 0;
private Date dateCreated;
public Account() {
dateCreated = new Date();
}
public Account(int id, double balance) {
this.id = id;
this.balance = balance;
dateCreated = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public static double getAnnualInterestRate() {
return annualInterestRate;
}
public static void setAnnualInterestRate(double annualInterestRate) {
Account.annualInterestRate = annualInterestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public double getMonthlyInterestRate() {
double monthlyInterestRate = getAnnualInterestRate() / 1200;
return monthlyInterestRate;
}
public double getMonthlyInterest() {
double monthlyInterest= getBalance() * getMonthlyInterestRate();
return monthlyInterest;
}
public void withdraw(double amount) {
balance = getBalance() - amount;
}
public void deposit(double amount) {
balance = getBalance() + amount;
}
}
Solution
//This is your Account Class
package com.ATMBanking;
import java.util.Date;
public class Account {
private int id;
private double balance;
static private double annualInterestRate = 0;
private Date dateCreated;
public Account() {
dateCreated = new Date();
}
public Account(int id, double balance) {
this.id = id;
this.balance = balance;
dateCreated = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public static double getAnnualInterestRate() {
return annualInterestRate;
}
public static void setAnnualInterestRate(double annualInterestRate) {
Account.annualInterestRate = annualInterestRate;
}
public Date getDateCreated() {
return dateCreat.
Hi,I have updated the code as per your requirement. Highlighted th.pdfannaindustries
Hi,
I have updated the code as per your requirement. Highlighted the code changes below.
Program2.java
import java.util.Scanner; // Needed for the Scanner class
import java.text.DecimalFormat; // Needed for 2 decimal place amounts
public class Program2
{
public static void main(String[] args)
{
BankAccount account; // To reference a BankAccount object
double balance, // The account\'s starting balance
interestRate, // The annual interest rate
pay, // The user\'s pay
cashNeeded; // The amount of cash to withdraw
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
// Create an object for dollars and cents
DecimalFormat formatter = new DecimalFormat (\"#0.00\");
// Get the starting balance.
System.out.print(\"What is your account\'s \" + \"starting balance? \");
balance = keyboard.nextDouble();
// Get the monthly interest rate.
System.out.print(\"What is your an annual interest rate? \");
interestRate = keyboard.nextDouble();
// Create a BankAccount object.
account = new BankAccount(balance, interestRate);
// Get the amount of pay for the month.
System.out.print(\"How much were you paid this month? \");
pay = keyboard.nextDouble();
// Deposit the user\'s pay into the account.
System.out.println(\"We will deposit your pay \" + \"into your account.\");
account.deposit(pay);
System.out.println(\"Your current balance is \" + formatter.format( account.getBalance() ));
// Withdraw some cash from the account.
System.out.print(\"How much would you like \" + \"to withdraw? \");
cashNeeded = keyboard.nextDouble();
account.withdraw(cashNeeded);
// Add the monthly interest to the account.
account.addInterest();
// Display the interest earned and the balance.
System.out.println(\"This month you have earned \" + formatter.format( account.getInterest() ) +
\" in interest.\");
System.out.println(\"Now your balance is \"+ formatter.format( account.getBalance() ) );
}
}
BankAccount.java
public class BankAccount
{
private double balance; // Account balance
private double interestRate; // Interest rate
private double interest; // Interest earned
/**
* The constructor initializes the balance
* and interestRate fields with the values
* passed to startBalance and intRate. The
* interest field is assigned to 0.0.
*/
public BankAccount(double startBalance, double intRate)
{
balance = startBalance;
interestRate = intRate / (12 * 100);
interest = 0.0;
}
/**
* The deposit method adds the parameter
* amount to the balance field.
*/
public void deposit(double amount)
{
balance += amount;
}
/**
* The withdraw method subtracts the
* parameter amount from the balance
* field.
*/
public void withdraw(double amount)
{
balance -= amount;
}
/**
* The addInterest method adds the interest
* for the month to the balance field.
*/
public void addInterest()
{
interest = balance * interestRate;
balance += interest;
}
/**
* The getBalance method returns the
* value in the balance field.
*/
public double getBalance()
{
return balance;
}
/**
* The getIn.
The java program that simulates ATM operations. The prog.pdfpoddaranand1
/**
* The java program that simulates ATM operations.
* The program display a menu of choices.
* The prompt to enter operation to perform
* and then print the balance after the transaction
* to console.
* */
//AtmSimDoLoop.java
import java.util.Scanner;
public class AtmSimDoLoop {
public static void main(String[] args) {
//Create a Scanner class object
Scanner scanner=new Scanner(System.in);
//declare variables
double balance=0;
int userChoice;
double deposit;
double withdrawl;
//set repeat =true
boolean repeat=true;
//prompt and repeat until user enters 4 to exit
do {
System.out.println(\"Enter the number of your desired transaction type.\");
System.out.println(\"1.Balance\");
System.out.println(\"2.Deposit\");
System.out.println(\"3.Withdrawl\");
System.out.println(\"4.Quit\");
userChoice=Integer.parseInt(scanner.nextLine());
//using switch case to select an appropriate choice
switch (userChoice) {
case 1:
System.out.println(\"Your current balance is \"+balance);
break;
case 2:
System.out.println(\"Enter the amount of the deposit \");
deposit=Double.parseDouble(scanner.nextLine());
balance+=deposit;
System.out.println(\"Your current balance is \"+balance);
break;
case 3:
System.out.println(\"Enter the amount of the withdrawl \");
withdrawl=Double.parseDouble(scanner.nextLine());
if(withdrawl<=balance)
{
balance-=withdrawl;
System.out.println(\"Your current balance is \"+balance);
}
else
System.out.println(\"Insufficient funds. Your current balance is \"+balance+\".\");
break;
case 4:
System.out.println(\"Good-bye.\");
//set repeat=false
repeat=false;
}
} while (repeat);
}//end of main
}//end of class AtmSimDoLoop
------------------------------------------------------------------------------------------------------------
Sample output:
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
1
Your current balance is 0.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
2
Enter the amount of the deposit
500
Your current balance is 500.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
3
Enter the amount of the withdrawl
300
Your current balance is 200.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
3
Enter the amount of the withdrawl
300
Insufficient funds. Your current balance is 200.0.
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
4
Good-bye.
Solution
/**
* The java program that simulates ATM operations.
* The program display a menu of choices.
* The prompt to enter operation to perform
* and then print the balance after the transaction
* to console.
* */
//AtmSimDoLoop.java
import java.util.Scanner;
public class AtmSimDoLoop {
public static void main(String[] args) {
//Create a Scanner class object
Scanner scanner=new Scanner(System.in);
//declare variables
double balance=0;
int userChoice;
double deposit;
double withdrawl;
//set repeat =tr.
WAP to create equivalent of a four function calculator. The program requires the user to enter two numbers and an operator. It then carries out the specified arithmetic operation: addition, subtraction, multiplication and division of two numbers.(using nested if statement)
I need help creating a basic and simple Java program. Here is the ex.pdfrajeshjangid1865
I need help creating a basic and simple Java program. Here is the exercise. I have included my
Account class that is referred to at the bottom, below the exercise.
Use the Account class created in Programming Exercise 9.7 to simulate an ATM machine.
Create ten accounts in an array with id 0, 1, . . . , 9, and initial balance $100. The system prompts
the user to enter an id. If the id is entered incorrectly, ask the user to enter a correct id. Once an
id is accepted, the main menu is displayed as shown in the sample run. You can enter a choice 1
for viewing the current balance, 2 for withdrawing money, 3 for depositing money, and 4 for
exiting the main menu. Once you exit, the system will prompt for an id again. Thus, once the
system starts, it will not stop. You will need to cntrl-c to stop your program; this is ok for this
assignment. If you want your program to terminate more elegantly you can add in additional
logic, but this is not required.
Please refer to textbook for sample output pg. 401.
Account.java
import java.util.Date;
public class Account {
private int id;
private double balance;
static private double annualInterestRate = 0;
private Date dateCreated;
public Account() {
dateCreated = new Date();
}
public Account(int id, double balance) {
this.id = id;
this.balance = balance;
dateCreated = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public static double getAnnualInterestRate() {
return annualInterestRate;
}
public static void setAnnualInterestRate(double annualInterestRate) {
Account.annualInterestRate = annualInterestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public double getMonthlyInterestRate() {
double monthlyInterestRate = getAnnualInterestRate() / 1200;
return monthlyInterestRate;
}
public double getMonthlyInterest() {
double monthlyInterest= getBalance() * getMonthlyInterestRate();
return monthlyInterest;
}
public void withdraw(double amount) {
balance = getBalance() - amount;
}
public void deposit(double amount) {
balance = getBalance() + amount;
}
}
Solution
//This is your Account Class
package com.ATMBanking;
import java.util.Date;
public class Account {
private int id;
private double balance;
static private double annualInterestRate = 0;
private Date dateCreated;
public Account() {
dateCreated = new Date();
}
public Account(int id, double balance) {
this.id = id;
this.balance = balance;
dateCreated = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public static double getAnnualInterestRate() {
return annualInterestRate;
}
public static void setAnnualInterestRate(double annualInterestRate) {
Account.annualInterestRate = annualInterestRate;
}
public Date getDateCreated() {
return dateCreat.
Hi,I have updated the code as per your requirement. Highlighted th.pdfannaindustries
Hi,
I have updated the code as per your requirement. Highlighted the code changes below.
Program2.java
import java.util.Scanner; // Needed for the Scanner class
import java.text.DecimalFormat; // Needed for 2 decimal place amounts
public class Program2
{
public static void main(String[] args)
{
BankAccount account; // To reference a BankAccount object
double balance, // The account\'s starting balance
interestRate, // The annual interest rate
pay, // The user\'s pay
cashNeeded; // The amount of cash to withdraw
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
// Create an object for dollars and cents
DecimalFormat formatter = new DecimalFormat (\"#0.00\");
// Get the starting balance.
System.out.print(\"What is your account\'s \" + \"starting balance? \");
balance = keyboard.nextDouble();
// Get the monthly interest rate.
System.out.print(\"What is your an annual interest rate? \");
interestRate = keyboard.nextDouble();
// Create a BankAccount object.
account = new BankAccount(balance, interestRate);
// Get the amount of pay for the month.
System.out.print(\"How much were you paid this month? \");
pay = keyboard.nextDouble();
// Deposit the user\'s pay into the account.
System.out.println(\"We will deposit your pay \" + \"into your account.\");
account.deposit(pay);
System.out.println(\"Your current balance is \" + formatter.format( account.getBalance() ));
// Withdraw some cash from the account.
System.out.print(\"How much would you like \" + \"to withdraw? \");
cashNeeded = keyboard.nextDouble();
account.withdraw(cashNeeded);
// Add the monthly interest to the account.
account.addInterest();
// Display the interest earned and the balance.
System.out.println(\"This month you have earned \" + formatter.format( account.getInterest() ) +
\" in interest.\");
System.out.println(\"Now your balance is \"+ formatter.format( account.getBalance() ) );
}
}
BankAccount.java
public class BankAccount
{
private double balance; // Account balance
private double interestRate; // Interest rate
private double interest; // Interest earned
/**
* The constructor initializes the balance
* and interestRate fields with the values
* passed to startBalance and intRate. The
* interest field is assigned to 0.0.
*/
public BankAccount(double startBalance, double intRate)
{
balance = startBalance;
interestRate = intRate / (12 * 100);
interest = 0.0;
}
/**
* The deposit method adds the parameter
* amount to the balance field.
*/
public void deposit(double amount)
{
balance += amount;
}
/**
* The withdraw method subtracts the
* parameter amount from the balance
* field.
*/
public void withdraw(double amount)
{
balance -= amount;
}
/**
* The addInterest method adds the interest
* for the month to the balance field.
*/
public void addInterest()
{
interest = balance * interestRate;
balance += interest;
}
/**
* The getBalance method returns the
* value in the balance field.
*/
public double getBalance()
{
return balance;
}
/**
* The getIn.
The java program that simulates ATM operations. The prog.pdfpoddaranand1
/**
* The java program that simulates ATM operations.
* The program display a menu of choices.
* The prompt to enter operation to perform
* and then print the balance after the transaction
* to console.
* */
//AtmSimDoLoop.java
import java.util.Scanner;
public class AtmSimDoLoop {
public static void main(String[] args) {
//Create a Scanner class object
Scanner scanner=new Scanner(System.in);
//declare variables
double balance=0;
int userChoice;
double deposit;
double withdrawl;
//set repeat =true
boolean repeat=true;
//prompt and repeat until user enters 4 to exit
do {
System.out.println(\"Enter the number of your desired transaction type.\");
System.out.println(\"1.Balance\");
System.out.println(\"2.Deposit\");
System.out.println(\"3.Withdrawl\");
System.out.println(\"4.Quit\");
userChoice=Integer.parseInt(scanner.nextLine());
//using switch case to select an appropriate choice
switch (userChoice) {
case 1:
System.out.println(\"Your current balance is \"+balance);
break;
case 2:
System.out.println(\"Enter the amount of the deposit \");
deposit=Double.parseDouble(scanner.nextLine());
balance+=deposit;
System.out.println(\"Your current balance is \"+balance);
break;
case 3:
System.out.println(\"Enter the amount of the withdrawl \");
withdrawl=Double.parseDouble(scanner.nextLine());
if(withdrawl<=balance)
{
balance-=withdrawl;
System.out.println(\"Your current balance is \"+balance);
}
else
System.out.println(\"Insufficient funds. Your current balance is \"+balance+\".\");
break;
case 4:
System.out.println(\"Good-bye.\");
//set repeat=false
repeat=false;
}
} while (repeat);
}//end of main
}//end of class AtmSimDoLoop
------------------------------------------------------------------------------------------------------------
Sample output:
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
1
Your current balance is 0.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
2
Enter the amount of the deposit
500
Your current balance is 500.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
3
Enter the amount of the withdrawl
300
Your current balance is 200.0
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
3
Enter the amount of the withdrawl
300
Insufficient funds. Your current balance is 200.0.
Enter the number of your desired transaction type.
1.Balance
2.Deposit
3.Withdrawl
4.Quit
4
Good-bye.
Solution
/**
* The java program that simulates ATM operations.
* The program display a menu of choices.
* The prompt to enter operation to perform
* and then print the balance after the transaction
* to console.
* */
//AtmSimDoLoop.java
import java.util.Scanner;
public class AtmSimDoLoop {
public static void main(String[] args) {
//Create a Scanner class object
Scanner scanner=new Scanner(System.in);
//declare variables
double balance=0;
int userChoice;
double deposit;
double withdrawl;
//set repeat =tr.
WAP to create equivalent of a four function calculator. The program requires the user to enter two numbers and an operator. It then carries out the specified arithmetic operation: addition, subtraction, multiplication and division of two numbers.(using nested if statement)
You are not setting any values for those variables(name, ID, interes.pdfdeepakangel
You are not setting any values for those variables(name, ID, interestRate, balance) when you
create the object. Hence, they are instantiated to 0 or null based on the type.
Add this to the main method:
String name = \"Jonathan\"; //any value
int ID = 22; //any value
double interestRate = 10.2; //any value
double balance = 100000.0 //any value
Hence, your final program should look like this:
import java.util.Scanner;
public class BankAccount
{
public BankAccount()
{
setName(\"\");
setID(0);
setBalance(0);
setInterestRate(0);
}
public BankAccount(String name, int ID, double balance, double interestRate)
{
setName(name);
setID(ID);
setBalance(balance);
setInterestRate(interestRate);
}
//name
private static String name;
public void setName (String Name)
{
this.name = name;
}
public String getName()
{
return name;
}
//ID
private static int ID;
public void setID (int ID)
{
this.ID = ID;
}
public int getID()
{
return ID;
}
//balance
private static double balance;
public void setBalance (double balance)
{
this.balance = balance;
}
public double getBalance()
{
return balance;
}
//interest rate
static double interestRate;
public void setInterestRate (double interestrate)
{
this.interestRate = interestRate;
}
public double getInterestRate()
{
return interestRate;
}
//new account
public static void newAccount()
{
Scanner scan = new Scanner(System.in);
System.out.println(\"Hello new bank user!\ \"
+ \"Welcome to the Bank of Jonathan!\");
//Have user input their name
System.out.print(\"Please enter your name: \ \");
name = scan.nextLine();
//An account ID (stored as text)
System.out.print(\"Please enter your Bank ID: \ \");
ID = scan.nextInt();
}
//my account
public static void myAccount()
{
Scanner scan = new Scanner(System.in);
System.out.println(\"Welcome to the Bank of Jonathan!\");
//Have user input their name
System.out.print(\"Please enter your name: \ \");
name = scan.nextLine();
//An account ID (stored as text)
System.out.print(\"Please enter your Bank ID: \ \");
ID = scan.nextInt();
double myBalance = 10000;
balance = myBalance;
}
// //*Two constructors
// //*1)Takes an initial Balance
// public BankAccount(String inputName, int inputID, double initialBalance)
// {
// name = inputName;
// ID = inputID;
// balance = initialBalance;
//
// //System.out.println(\"Name: \"
// //+ inputName);
// //System.out.println(\"The Intial balance is: \"
// //+ inputID);
// //System.out.println(\"The Intial balance is: \"
// //+ initialBalance);
// }
//
// //*2)Opens a new account with no money
// // public BankAccount()
// // {
// // balance = 0.00;
// // }
//A Deposit Method
public static void deposit()
{
Scanner scan = new Scanner(System.in);
System.out.printf(\"How much would you like to deposit?\ \"
+ \"Enter amount here: $\");
double depositAmount = scan.nextDouble();
while(depositAmount <= 0.00)
{
System.out.println(\"Invalid deposit amount!\");
System.out.printf(\"How much would you like to deposit?\ \"
+ \"Enter amount here: $\");
depositAmount = scan.ne.
The java Payroll that prompts user to enter hourly rate .pdfangelfashions02
/**
* The java Payroll that prompts user to enter
* hourly rate of pay and number of hours worked.
* Then calculates the gross pay and net pay
* and print to console.
* */
//Payroll.java
import java.util.Scanner;
public class Payroll
{
public static void main(String[] args)
{
//declare variables for hourly rate and hours worked
double hourlyRate;
int hoursWorked;
//Set tax rate as 0.15 (15 percent )
final double WITH_HOLD_TAX=0.15;
//Set grossPay=0
double grossPay=0;
//Set tax =0
double tax=0;
//Set netPay=0
double netPay=0;
//Create an instance of Scanner class
Scanner inputScanner =new Scanner(System.in);
System.out.println(\"Enter hourly rate of pay\");
//prompt for hourly rate
hourlyRate=Integer.parseInt(inputScanner.nextLine());
System.out.println(\"Enter number of hours worked\");
//prompt for number of hours
hoursWorked=Integer.parseInt(inputScanner.nextLine());
//Calculate grossPay
//multiply hoursWorked by hourlyRate
grossPay=hoursWorked*hourlyRate;
//calculate with hold tax
tax=grossPay*WITH_HOLD_TAX;
//calculate netPay
//subtract tax from grossPay
netPay=grossPay-tax;
//print gross pay and net pay to console
System.out.println(\"Gross Pay : \"+grossPay);
System.out.println(\"Net pay : \"+netPay);
}
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Sample output:
Enter hourly rate of pay
10
Enter number of hours worked
50
Gross Pay : 500.0
Net pay : 425.0
Solution
/**
* The java Payroll that prompts user to enter
* hourly rate of pay and number of hours worked.
* Then calculates the gross pay and net pay
* and print to console.
* */
//Payroll.java
import java.util.Scanner;
public class Payroll
{
public static void main(String[] args)
{
//declare variables for hourly rate and hours worked
double hourlyRate;
int hoursWorked;
//Set tax rate as 0.15 (15 percent )
final double WITH_HOLD_TAX=0.15;
//Set grossPay=0
double grossPay=0;
//Set tax =0
double tax=0;
//Set netPay=0
double netPay=0;
//Create an instance of Scanner class
Scanner inputScanner =new Scanner(System.in);
System.out.println(\"Enter hourly rate of pay\");
//prompt for hourly rate
hourlyRate=Integer.parseInt(inputScanner.nextLine());
System.out.println(\"Enter number of hours worked\");
//prompt for number of hours
hoursWorked=Integer.parseInt(inputScanner.nextLine());
//Calculate grossPay
//multiply hoursWorked by hourlyRate
grossPay=hoursWorked*hourlyRate;
//calculate with hold tax
tax=grossPay*WITH_HOLD_TAX;
//calculate netPay
//subtract tax from grossPay
netPay=grossPay-tax;
//print gross pay and net pay to console
System.out.println(\"Gross Pay : \"+grossPay);
System.out.println(\"Net pay : \"+netPay);
}
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Sample output:
E.
import java.util.Scanner;
import java.text.DecimalFormat;
import java.io.*;
public class SavingAccount //MUST match the file name!
{
public static void main(String[] args)throws IOException
{
//Create a decimal format for displaying dollars
DecimalFormat dollar = new DecimalFormat(\"#,###.##\");
//Constants
double depositSum = 0.0;
double withdrawalSum = 0.0;
double earnedInt = 0.0;
double startBalance = 500; //Starting balance
// Executables
System.out.println(\"This program solves Programming Challenge 6.11\");
System.out.println();
//Create Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
//Get interest rate
System.out.print(\"Enter the annual interest: \");
double testInterest = keyboard.nextDouble();
//Create an object that accept the starting balance and annual interest
SavingAccount1 account = new SavingAccount1(startBalance, testInterest);
//Open Deposit file.
File file = new File (\"BankDeposits.txt\");
Scanner inputFile = new Scanner(file);
//Read line in file
while (inputFile.hasNext());
{
//Read numbers
double num = inputFile.nextDouble();
//Add the numbers
depositSum += num;
}
//Deposit the file input.
account.deposit(depositSum);
//Close the file
inputFile.close();
//Open Withdrawal file
File file2 = new File(\"BankWithdrawal.txt\");
Scanner inputFile2 = new Scanner(file2);
//Read lines in file
while (inputFile2.hasNext());
{
//Read numbers
double num2 = inputFile2.nextDouble();
//Add the numbers
withdrawalSum += num2;
}
//Withdrawal the file input from account.
account.withdraw(withdrawalSum);
//Close the file
inputFile2.close();
//Add the monthly interest
account.addInt();
//Get amount of interest earned.
earnedInt += account.getInterest();
//Display the data
System.out.println(\"Account balance $\" + dollar.format(account.getBalance()));
System.out.println(\"Total interest earned $\" + dollar.format(account.getInterest()));
}
}//end class
public class SavingAccount1 //MUST match the file name!
{
public static void main(String[] args)
{
System.out.println(\"This program solves Programming Challenge 6.10\");
System.out.println();
}
//Fields
private double balance; //Account balance
private double annualInterest; //annual interest
private double monthInt; //monthly interest
private double earnedInt; //earned interest
double totalWithdraw;
double totalDeposit;
/**
018
This constructor sets the starting balance
019
and the annual interest at 0.0.
020
*/
public void Ward_Tassinda_SavingAccount1()
{
balance = 0.0;
annualInterest = 0.0;
}
/**
029
This constructor set the starting balance and the annual interest rate
030
to the value passed as an argument.
031
@param startBalance The starting balance.
032
*/
public void Ward_Tassinda_SavingAccount1(double startBalance, double interestRate)
{
balance = startBalance;
annualInterest = interestRate;
}
/**
041
This constructor sets the starting balance to
042
the value in the String argument.
043
@param str The starting balance, as a String.
044
*/
public void .
Change to oop formatimport java.util.Scanner;import java.io.;.pdfMAYANKBANSAL1981
Change to oop format
import java.util.Scanner;
import java.io.*;
import java.text.DecimalFormat;
public class Amortization {
/* call values in, set balance and principle. set month to increment until reaching number
provided. use \t to space out result well.
Use PritWriter output instead of System.output to make the notepad file.*/
public static void createReport(String filename, double loan, double interestRate, int years)
throws IOException {
PrintWriter output = new PrintWriter(new FileWriter(filename));
double monthlyPayment = calcPayment(loan, interestRate, years);
int numberOfPayments = getNumberOfPayments(years);
double balance = loan;
output.println("{Monthly Payment}: " + monthlyPayment);
output.println("{Month} \t {Interest} \t {Principal} \t {Balance}");
for (int month = 1; month <= numberOfPayments; month++) {
double interest = balance * (interestRate / 12);
double principal = monthlyPayment - interest;
balance -= principal;
output.printf("%d \t \t %.2f \t \t %.2f \t \t %.2f \\\n", month, interest, principal, balance);
}
output.close();
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
DecimalFormat df = new DecimalFormat("#.##");
do {
/* Data members */
double loan;
int years;
double interestRate;
/* Get amount, interest rate, and years from the user */
System.out.println("Enter the loan amount: ");
loan = keyboard.nextDouble();
System.out.println("Enter the annual interest rate: ");
interestRate = keyboard.nextDouble() / 100.0;
System.out.println("Enter the years of the loan: ");
years = keyboard.nextInt();
double payment = calcPayment(loan, interestRate, years);
if (payment < 0) {
System.out.println("Invalid input values.");
} else {
System.out.println("Monthly Payment: " + df.format(payment));
int numberOfPayments = getNumberOfPayments(years);
System.out.println("Total Number of Payments: " + numberOfPayments);
try {
createReport("LoanAmortization.txt", loan, interestRate, years);
System.out.println("Report created successfully.");
} catch (IOException e)
{
System.out.println("Error creating report: " + e.getMessage());
}
}
System.out.println("Would you like to run another report? Enter Y for yes or N for no: ");
} while (keyboard.next().equalsIgnoreCase("Y"));
keyboard.close();
}
public static double calcPayment(double loan, double interestRate, int years) {
double term = Math.pow(1 + (interestRate / 12), years * 12);
double payment = (loan * (interestRate / 12) * term) / (term - 1);
return payment;
}
public static int getNumberOfPayments(int years) {
return years * 12; // Assuming monthly payments for the given number of years
}
public static void createReport(String filename) throws IOException {
// Sample implementation to save data to a file
PrintWriter out = new PrintWriter(new FileWriter(filename, true));
out.println("Sample Data");
out.close();
}
}.
- the modification will be done in Main class- first, asks the use.pdfhanumanparsadhsr
- the modification will be done in Main class
- first, asks the user if it is a regular user or from the company.
-second, compare the username and password if it is from a company.
note:
-the code:
package project;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class project {
private static final int MAX_INVALID_INPUTS = 3;
private static final String LOG_FILE_PATH = "failed_attempts.txt";
public static void main(String[] args) {
SE_dep SE_obj = new SE_dep();
CSAI_Dep csaiDepartment = new CSAI_Dep();
CY_Dep cyDepartment = new CY_Dep();
DS_Dep dsDep = new DS_Dep();
double SE_minIndustSalary;
double SE_prevGPA;
String SE_interestOfStudent;
Scanner input = new Scanner(System.in);
System.out.println("Please enter the Minimum acceptable industry salary: ");
SE_minIndustSalary = validateInput(input, 10); // Maximum of 10 digits
System.out.println("Please Enter Your previous GPA: ");
SE_prevGPA = validateInput(input, 3); // Maximum of 3 digits
SE_interestOfStudent = validateInterestInput(input);
System.out.println("Student inputs: Minimum acceptable industry salary[" +
SE_minIndustSalary + "] Previous GPA[" + SE_prevGPA + "] Computer Programming
interest[" + SE_interestOfStudent + "]");
System.out.println("Suggested programs:\n\n");
SE_obj.ifIncluded_SE(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
cyDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
csaiDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
dsDep.DS_Program(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
double studyHours = SE_prevGPA * 1.0; // Each GPA point corresponds to 1 hour of study
int hours = (int) studyHours; // Extract the integer part (hours)
int minutes = (int) ((studyHours - hours) * 60); // Calculate the minutes
System.out.println("Required study hours (at home beside lectures): " + hours + " hours and
" + minutes + " minutes");
input.close();
}
private static double validateInput(Scanner input, int maxDigits) {
int invalidInputs = 0;
while (invalidInputs < MAX_INVALID_INPUTS) {
String userInput = input.next();
try {
double value = Double.parseDouble(userInput);
if (userInput.length() <= maxDigits) {
return value; // Input has the desired number of digits, return the value
} else {
System.out.println("Invalid input! Please enter a number with no more than " +
maxDigits + " digits: ");
invalidInputs++;
}
} catch (NumberFormatException e) {
invalidInputs++;
System.out.println("Invalid input! Please enter a valid number: ");
}
}
System.out.println("Maximum number of invalid inputs reached. Exiting...");
logFailedAttempt("Invalid input: " + input);
System.exit(0); // Terminate the program gracefully
return 0; // This line won't be executed, added to satisfy the method return type
}
private static String validateInterestInput(Scanner input).
Write the program segment necessary to Test the C flag. i. If the .pdffathimafancy
Write the following strings using ASCII encoding. Write your final answers in hexadecimal.
(a) SOS
(b) Cool
(c) boo!
Show how the strings are stored in a byte-addressable memory on a little-endian machine
starting at memory address 0x00001050C. Clearly indicate the memory address of each byte.
Solution
Answet contains ASCII code and hexadecimal code is in bracket.
a) 83 79 83 (53 4F 53)
b) 67 111 111 108 (43 6F 6F 6C)
c) 98 111 111 33(62 6F 6F 21).
Why must Group IV be treated with (NH4)2CO3 in basic solution What .pdffathimafancy
Why is a 99% condence interval wider than a 95% condence interval?
Solution
confidence intervals are usually expressed with 95% confidence, this is just a tradition.
Confidence intervals can be computed for any desired degree of confidence.
People are often surprised to learn that 99% confidence intervals are wider than 95% intervals,
and 90% intervals are narrower. But this makes perfect sense. If you want more confidence that
an interval contains the true parameter, then the intervals will be wider. If you want to be
100.000% sure that an interval contains the true population, it has to contain every possible value
so be very wide. If you are willing to be only 50% sure that an interval contains the true value,
then it can be much narrower..
what is IOT what us SolutionAns. IOT stands for Internet of Th.pdffathimafancy
What happens when a business is able to segment a market on the basis of needs, but unable to
demographically or behaviorally identify the segments?
Solution
There are four types of segmentation, which are demographic, geographic, psychographic and
behavioral. When a business is able to segment a market on the basis of needs, but unable to
demographically or behaviorally identify the segment, then the business will survive for a short
term only. The business would be able to fulfill the needs of their customers for a shorter span of
time, but it requires proper strategy and segmentation to be done to sustain and be succeed in a
long run..
What is the difference between a BSS and a ESSSolutionBSS sta.pdffathimafancy
what is IOT what us
Solution
Ans. IOT stands for Internet of Things: It is a connection of devices over internet to build
applications and services which will serve people needs.
It is a network of applications built over a planned structure to make human lives easy. It can
cover as small a need like an email protocol to as large a need as smart homes. With the advent
of internet and cloud technologies, it has a bright future ahead. It can be extended to army
services too..
What is the role of capsid and nucleocapsid proteins during the life.pdffathimafancy
What is the major difference between a hub and switch, which one is more efficient at routing
traffic, and which is preferable in larger network configurations?
Solution
The term\' Hub\' usually refers to a piece of network equipment which connects personal
computers together.This type of device carry forwards the information it receives so that it\'s
ports receive the information.Hubs repeat everything they receive and can be used to extend the
network.This can cause unnecessary traffic being send to devices in a network.This kind of
repeating is not a problem in the case of smaller networks but for larger traffic it becomes a
problem so we need to implement another network equipment called switch.
Switches control the netwok traffic by containing the address information of each packet and it
checks to which ports it has to send packets and sends on packets to relevant ports only.This
allows simultaneous communication across switch by improving bandwidth utilisation.
Hubs are used in smaller networks and are used to extend network by providing more number of
ports and switches divide the network into smaller and less blocked sections. Finally switches are
more efficient at routing traffic..
What distinguish between managerial and financial accounting as to (.pdffathimafancy
What are the similarities between internal and external agents? What are the differences?
Are all consultants change agents? Are all change agents consultants? When does a manager or
leader act as a change agent?
What about change is disruptive? How can meeting the challenge of change becaome
organizational opportunities?
Solution
Internal and external agents have similarities as they both act as change agents and want to bring
necessary change that can improve the organization and the organization can capitalize upon the
new opportunities. Though there are many differences between the internal and external agents.
Internal agents belong to the organization, whereas the external agent is hired as consultant by
the organization. An external agent will be the expertise upon the issues for that he or she is
hired, but an internal agent may not be the expert for the change management. External agent is
hired for a fixed period of time, but internal agent works for indefinitely for the organization.
Consultants are the people who hold expertise in particular areas, so the consultants can be hired
as change agent. But, they may not necessarily be used as change agent. All change agents may
not be consultants as internal resources such as managers and leaders within the organization,
can also act as a change management. When an organization wants to use internal agents for the
change process, then managers and leaders act as change management.
A disruptive change refers to the change in the organizational structure and process that creates
opportunities and make an old structure to be obsolete and irrelevant. Besides, the disruptive
change in fast and quick that unfreeze, redesign and refreeze the organization.
A change management brings the necessary change in the organizational structure and make the
organization to be adaptive to the new market conditions. While doing so, the organization
becomes lean and starts continuous scanning of the market conditions. It helps the organization
to capitalize on new opportunities on offer by the market environment..
There is a lack of spirituality in a person that cheats because they.pdffathimafancy
The Value Part
Comment on a service organization that provides for you. My favorite is the local hardware
store. They carry a ton of different items. I go in and ask for something and they normally carry
it and will sell me just the amount I need. Home Depot will sell me the item in a 100 unit box
when I only need 10 pieces.
Do service organizations add value to society? Well, according to the MA Dept of Revenue, over
85% of the persons who filed MA Income Taxes, their primary (largest) source of income came
from a service organization. Massachusetts would be in deep trouble financially if there were
only a few service organization were paying wages in this state.
Do you think the US economy needs service organizations?
Solution
With constant technological advancements and the increasing need of producing a steady stream
of revenue from ongoing contracts instead of having a single payment coming from a sold
manufactured product, more and more companies are adapting to the idea of transforming their
age-old traditional manufacturing business to a product-service system. The businesses are now
shifting to a subscription pricing model from the existing lump-sum one-time payment systems.
Talking about the servitisation of products, service industries such as hospitality, retail, banking,
health, information technology, education, etc. focus on service aspect of the business more than
the product aspect. These industries are mass employment providers and heavily invest in their
human capital. Service organisations make use of the skillset, knowledge, experience and talent
of their human resources to produce valuable outcomes for their customers. Whereas,
manufacturing organisations are accused of exploiting depleting natural resources by using them
as raw materials and in return, adversely affects the environment and adding to the prevailing
environmental issues such as pollution and global warming.
The importance of the service organisations in the US economy can be measured by the fact that
in the latest list of Fortune 500 companies, there are more number of service organisations than
number of manufacturers and product-based organisations in comparison to the fortune 500 lists
of past decades. Today, no company can boast of being just a product-based organisation.
Service has become an inseparable component of the product offering. As mentioned in the case,
according to the Massachusetts Department of Revenue, over 85% of the people who filed MA
income taxes had their primary income source coming from a service organisation. This shows
the huge employment opportunities that the service organisations have to offer in the economy.
There is no denying that the relative importance of service is increasing in the product offering of
many organisations. Take the example of IBM that treats its business as a service business
instead of a manufacturing business. Inspite of being in the business of manufacturing of
computers, the management of IBM over .
select the answer a general search engine differs from a subject di.pdffathimafancy
Section 2: Journal Entries (20 points) As of July 1, 2016, the City of Saratoga Springs decided to
purchase a privately operated swimming pool and to create a swimming pool fund. During the
year, the following transactions occurred: (a) $1,000,000 was borrowed with a note payable from
a local bank at an interest rate of 6%, (b) Purchased the following items in cash: a. Land b.
Building e. Land improvements $400,000 d. Equipment e. Supplies $300,000 $400,000
$200,000 $190,000 (c) Charges for services amounted to $600,000, all received in cash. (d)
Depreciation was recorded for the followings in the amounts specified below a. Building b. Land
improvements$40,000 c. Equipment $20,000 S20,000 1. In what fund does this need to be
accounted for? (Name the fund.) (4 points) When converted to government wide financial
statements, in which column should this fund be included? (4 points) Journal entries ( points
each)
Solution
SOLUTION:DebitCredit1Cash100,000Note payable100,0002Land300,000Building400,000Land
Improvement400,000Equipment200,000Supplies190,000Cash1,490,0003Cash600,000Operating
revenue- charge for services600,0004Operating expense-Depreciation80,000Accumulated
depreciation - Building20,000Accumulated depreciation - Land
Improvement40,000Accumulated depreciation - Equipment20,000.
State briefly what functions an Engineering Services Department in a.pdffathimafancy
Some of the major challenges to international expansion include all of the following except:
A. Political Risks
B. Unrelated diversification
C. Economic risks
D. Managerial Risks
Solution
The correct answer is option B.
Conducting business globally is very important and crucial decision made by the business and
require lots of effort and correct decisions in order to make it an effective move. It not only
provide new opportunities for growth and profit but also provide reputation to business globally.
There are several risk and challenges associated with doing business globally and a business
should consider these factors. These aspects are very important to consider when selecting an
international market to enter. They are:-
Unrelated diversification is nothing but the diversification when unrelated product lines and new
markets are added to current business. Example- Clothing manufacturer enters into watch
manufacturing business..
More Related Content
Similar to Java programI made this Account.java below. Using the attached cod.pdf
You are not setting any values for those variables(name, ID, interes.pdfdeepakangel
You are not setting any values for those variables(name, ID, interestRate, balance) when you
create the object. Hence, they are instantiated to 0 or null based on the type.
Add this to the main method:
String name = \"Jonathan\"; //any value
int ID = 22; //any value
double interestRate = 10.2; //any value
double balance = 100000.0 //any value
Hence, your final program should look like this:
import java.util.Scanner;
public class BankAccount
{
public BankAccount()
{
setName(\"\");
setID(0);
setBalance(0);
setInterestRate(0);
}
public BankAccount(String name, int ID, double balance, double interestRate)
{
setName(name);
setID(ID);
setBalance(balance);
setInterestRate(interestRate);
}
//name
private static String name;
public void setName (String Name)
{
this.name = name;
}
public String getName()
{
return name;
}
//ID
private static int ID;
public void setID (int ID)
{
this.ID = ID;
}
public int getID()
{
return ID;
}
//balance
private static double balance;
public void setBalance (double balance)
{
this.balance = balance;
}
public double getBalance()
{
return balance;
}
//interest rate
static double interestRate;
public void setInterestRate (double interestrate)
{
this.interestRate = interestRate;
}
public double getInterestRate()
{
return interestRate;
}
//new account
public static void newAccount()
{
Scanner scan = new Scanner(System.in);
System.out.println(\"Hello new bank user!\ \"
+ \"Welcome to the Bank of Jonathan!\");
//Have user input their name
System.out.print(\"Please enter your name: \ \");
name = scan.nextLine();
//An account ID (stored as text)
System.out.print(\"Please enter your Bank ID: \ \");
ID = scan.nextInt();
}
//my account
public static void myAccount()
{
Scanner scan = new Scanner(System.in);
System.out.println(\"Welcome to the Bank of Jonathan!\");
//Have user input their name
System.out.print(\"Please enter your name: \ \");
name = scan.nextLine();
//An account ID (stored as text)
System.out.print(\"Please enter your Bank ID: \ \");
ID = scan.nextInt();
double myBalance = 10000;
balance = myBalance;
}
// //*Two constructors
// //*1)Takes an initial Balance
// public BankAccount(String inputName, int inputID, double initialBalance)
// {
// name = inputName;
// ID = inputID;
// balance = initialBalance;
//
// //System.out.println(\"Name: \"
// //+ inputName);
// //System.out.println(\"The Intial balance is: \"
// //+ inputID);
// //System.out.println(\"The Intial balance is: \"
// //+ initialBalance);
// }
//
// //*2)Opens a new account with no money
// // public BankAccount()
// // {
// // balance = 0.00;
// // }
//A Deposit Method
public static void deposit()
{
Scanner scan = new Scanner(System.in);
System.out.printf(\"How much would you like to deposit?\ \"
+ \"Enter amount here: $\");
double depositAmount = scan.nextDouble();
while(depositAmount <= 0.00)
{
System.out.println(\"Invalid deposit amount!\");
System.out.printf(\"How much would you like to deposit?\ \"
+ \"Enter amount here: $\");
depositAmount = scan.ne.
The java Payroll that prompts user to enter hourly rate .pdfangelfashions02
/**
* The java Payroll that prompts user to enter
* hourly rate of pay and number of hours worked.
* Then calculates the gross pay and net pay
* and print to console.
* */
//Payroll.java
import java.util.Scanner;
public class Payroll
{
public static void main(String[] args)
{
//declare variables for hourly rate and hours worked
double hourlyRate;
int hoursWorked;
//Set tax rate as 0.15 (15 percent )
final double WITH_HOLD_TAX=0.15;
//Set grossPay=0
double grossPay=0;
//Set tax =0
double tax=0;
//Set netPay=0
double netPay=0;
//Create an instance of Scanner class
Scanner inputScanner =new Scanner(System.in);
System.out.println(\"Enter hourly rate of pay\");
//prompt for hourly rate
hourlyRate=Integer.parseInt(inputScanner.nextLine());
System.out.println(\"Enter number of hours worked\");
//prompt for number of hours
hoursWorked=Integer.parseInt(inputScanner.nextLine());
//Calculate grossPay
//multiply hoursWorked by hourlyRate
grossPay=hoursWorked*hourlyRate;
//calculate with hold tax
tax=grossPay*WITH_HOLD_TAX;
//calculate netPay
//subtract tax from grossPay
netPay=grossPay-tax;
//print gross pay and net pay to console
System.out.println(\"Gross Pay : \"+grossPay);
System.out.println(\"Net pay : \"+netPay);
}
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Sample output:
Enter hourly rate of pay
10
Enter number of hours worked
50
Gross Pay : 500.0
Net pay : 425.0
Solution
/**
* The java Payroll that prompts user to enter
* hourly rate of pay and number of hours worked.
* Then calculates the gross pay and net pay
* and print to console.
* */
//Payroll.java
import java.util.Scanner;
public class Payroll
{
public static void main(String[] args)
{
//declare variables for hourly rate and hours worked
double hourlyRate;
int hoursWorked;
//Set tax rate as 0.15 (15 percent )
final double WITH_HOLD_TAX=0.15;
//Set grossPay=0
double grossPay=0;
//Set tax =0
double tax=0;
//Set netPay=0
double netPay=0;
//Create an instance of Scanner class
Scanner inputScanner =new Scanner(System.in);
System.out.println(\"Enter hourly rate of pay\");
//prompt for hourly rate
hourlyRate=Integer.parseInt(inputScanner.nextLine());
System.out.println(\"Enter number of hours worked\");
//prompt for number of hours
hoursWorked=Integer.parseInt(inputScanner.nextLine());
//Calculate grossPay
//multiply hoursWorked by hourlyRate
grossPay=hoursWorked*hourlyRate;
//calculate with hold tax
tax=grossPay*WITH_HOLD_TAX;
//calculate netPay
//subtract tax from grossPay
netPay=grossPay-tax;
//print gross pay and net pay to console
System.out.println(\"Gross Pay : \"+grossPay);
System.out.println(\"Net pay : \"+netPay);
}
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Sample output:
E.
import java.util.Scanner;
import java.text.DecimalFormat;
import java.io.*;
public class SavingAccount //MUST match the file name!
{
public static void main(String[] args)throws IOException
{
//Create a decimal format for displaying dollars
DecimalFormat dollar = new DecimalFormat(\"#,###.##\");
//Constants
double depositSum = 0.0;
double withdrawalSum = 0.0;
double earnedInt = 0.0;
double startBalance = 500; //Starting balance
// Executables
System.out.println(\"This program solves Programming Challenge 6.11\");
System.out.println();
//Create Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
//Get interest rate
System.out.print(\"Enter the annual interest: \");
double testInterest = keyboard.nextDouble();
//Create an object that accept the starting balance and annual interest
SavingAccount1 account = new SavingAccount1(startBalance, testInterest);
//Open Deposit file.
File file = new File (\"BankDeposits.txt\");
Scanner inputFile = new Scanner(file);
//Read line in file
while (inputFile.hasNext());
{
//Read numbers
double num = inputFile.nextDouble();
//Add the numbers
depositSum += num;
}
//Deposit the file input.
account.deposit(depositSum);
//Close the file
inputFile.close();
//Open Withdrawal file
File file2 = new File(\"BankWithdrawal.txt\");
Scanner inputFile2 = new Scanner(file2);
//Read lines in file
while (inputFile2.hasNext());
{
//Read numbers
double num2 = inputFile2.nextDouble();
//Add the numbers
withdrawalSum += num2;
}
//Withdrawal the file input from account.
account.withdraw(withdrawalSum);
//Close the file
inputFile2.close();
//Add the monthly interest
account.addInt();
//Get amount of interest earned.
earnedInt += account.getInterest();
//Display the data
System.out.println(\"Account balance $\" + dollar.format(account.getBalance()));
System.out.println(\"Total interest earned $\" + dollar.format(account.getInterest()));
}
}//end class
public class SavingAccount1 //MUST match the file name!
{
public static void main(String[] args)
{
System.out.println(\"This program solves Programming Challenge 6.10\");
System.out.println();
}
//Fields
private double balance; //Account balance
private double annualInterest; //annual interest
private double monthInt; //monthly interest
private double earnedInt; //earned interest
double totalWithdraw;
double totalDeposit;
/**
018
This constructor sets the starting balance
019
and the annual interest at 0.0.
020
*/
public void Ward_Tassinda_SavingAccount1()
{
balance = 0.0;
annualInterest = 0.0;
}
/**
029
This constructor set the starting balance and the annual interest rate
030
to the value passed as an argument.
031
@param startBalance The starting balance.
032
*/
public void Ward_Tassinda_SavingAccount1(double startBalance, double interestRate)
{
balance = startBalance;
annualInterest = interestRate;
}
/**
041
This constructor sets the starting balance to
042
the value in the String argument.
043
@param str The starting balance, as a String.
044
*/
public void .
Change to oop formatimport java.util.Scanner;import java.io.;.pdfMAYANKBANSAL1981
Change to oop format
import java.util.Scanner;
import java.io.*;
import java.text.DecimalFormat;
public class Amortization {
/* call values in, set balance and principle. set month to increment until reaching number
provided. use \t to space out result well.
Use PritWriter output instead of System.output to make the notepad file.*/
public static void createReport(String filename, double loan, double interestRate, int years)
throws IOException {
PrintWriter output = new PrintWriter(new FileWriter(filename));
double monthlyPayment = calcPayment(loan, interestRate, years);
int numberOfPayments = getNumberOfPayments(years);
double balance = loan;
output.println("{Monthly Payment}: " + monthlyPayment);
output.println("{Month} \t {Interest} \t {Principal} \t {Balance}");
for (int month = 1; month <= numberOfPayments; month++) {
double interest = balance * (interestRate / 12);
double principal = monthlyPayment - interest;
balance -= principal;
output.printf("%d \t \t %.2f \t \t %.2f \t \t %.2f \\\n", month, interest, principal, balance);
}
output.close();
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
DecimalFormat df = new DecimalFormat("#.##");
do {
/* Data members */
double loan;
int years;
double interestRate;
/* Get amount, interest rate, and years from the user */
System.out.println("Enter the loan amount: ");
loan = keyboard.nextDouble();
System.out.println("Enter the annual interest rate: ");
interestRate = keyboard.nextDouble() / 100.0;
System.out.println("Enter the years of the loan: ");
years = keyboard.nextInt();
double payment = calcPayment(loan, interestRate, years);
if (payment < 0) {
System.out.println("Invalid input values.");
} else {
System.out.println("Monthly Payment: " + df.format(payment));
int numberOfPayments = getNumberOfPayments(years);
System.out.println("Total Number of Payments: " + numberOfPayments);
try {
createReport("LoanAmortization.txt", loan, interestRate, years);
System.out.println("Report created successfully.");
} catch (IOException e)
{
System.out.println("Error creating report: " + e.getMessage());
}
}
System.out.println("Would you like to run another report? Enter Y for yes or N for no: ");
} while (keyboard.next().equalsIgnoreCase("Y"));
keyboard.close();
}
public static double calcPayment(double loan, double interestRate, int years) {
double term = Math.pow(1 + (interestRate / 12), years * 12);
double payment = (loan * (interestRate / 12) * term) / (term - 1);
return payment;
}
public static int getNumberOfPayments(int years) {
return years * 12; // Assuming monthly payments for the given number of years
}
public static void createReport(String filename) throws IOException {
// Sample implementation to save data to a file
PrintWriter out = new PrintWriter(new FileWriter(filename, true));
out.println("Sample Data");
out.close();
}
}.
- the modification will be done in Main class- first, asks the use.pdfhanumanparsadhsr
- the modification will be done in Main class
- first, asks the user if it is a regular user or from the company.
-second, compare the username and password if it is from a company.
note:
-the code:
package project;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class project {
private static final int MAX_INVALID_INPUTS = 3;
private static final String LOG_FILE_PATH = "failed_attempts.txt";
public static void main(String[] args) {
SE_dep SE_obj = new SE_dep();
CSAI_Dep csaiDepartment = new CSAI_Dep();
CY_Dep cyDepartment = new CY_Dep();
DS_Dep dsDep = new DS_Dep();
double SE_minIndustSalary;
double SE_prevGPA;
String SE_interestOfStudent;
Scanner input = new Scanner(System.in);
System.out.println("Please enter the Minimum acceptable industry salary: ");
SE_minIndustSalary = validateInput(input, 10); // Maximum of 10 digits
System.out.println("Please Enter Your previous GPA: ");
SE_prevGPA = validateInput(input, 3); // Maximum of 3 digits
SE_interestOfStudent = validateInterestInput(input);
System.out.println("Student inputs: Minimum acceptable industry salary[" +
SE_minIndustSalary + "] Previous GPA[" + SE_prevGPA + "] Computer Programming
interest[" + SE_interestOfStudent + "]");
System.out.println("Suggested programs:\n\n");
SE_obj.ifIncluded_SE(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
cyDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
csaiDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
dsDep.DS_Program(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
double studyHours = SE_prevGPA * 1.0; // Each GPA point corresponds to 1 hour of study
int hours = (int) studyHours; // Extract the integer part (hours)
int minutes = (int) ((studyHours - hours) * 60); // Calculate the minutes
System.out.println("Required study hours (at home beside lectures): " + hours + " hours and
" + minutes + " minutes");
input.close();
}
private static double validateInput(Scanner input, int maxDigits) {
int invalidInputs = 0;
while (invalidInputs < MAX_INVALID_INPUTS) {
String userInput = input.next();
try {
double value = Double.parseDouble(userInput);
if (userInput.length() <= maxDigits) {
return value; // Input has the desired number of digits, return the value
} else {
System.out.println("Invalid input! Please enter a number with no more than " +
maxDigits + " digits: ");
invalidInputs++;
}
} catch (NumberFormatException e) {
invalidInputs++;
System.out.println("Invalid input! Please enter a valid number: ");
}
}
System.out.println("Maximum number of invalid inputs reached. Exiting...");
logFailedAttempt("Invalid input: " + input);
System.exit(0); // Terminate the program gracefully
return 0; // This line won't be executed, added to satisfy the method return type
}
private static String validateInterestInput(Scanner input).
Write the program segment necessary to Test the C flag. i. If the .pdffathimafancy
Write the following strings using ASCII encoding. Write your final answers in hexadecimal.
(a) SOS
(b) Cool
(c) boo!
Show how the strings are stored in a byte-addressable memory on a little-endian machine
starting at memory address 0x00001050C. Clearly indicate the memory address of each byte.
Solution
Answet contains ASCII code and hexadecimal code is in bracket.
a) 83 79 83 (53 4F 53)
b) 67 111 111 108 (43 6F 6F 6C)
c) 98 111 111 33(62 6F 6F 21).
Why must Group IV be treated with (NH4)2CO3 in basic solution What .pdffathimafancy
Why is a 99% condence interval wider than a 95% condence interval?
Solution
confidence intervals are usually expressed with 95% confidence, this is just a tradition.
Confidence intervals can be computed for any desired degree of confidence.
People are often surprised to learn that 99% confidence intervals are wider than 95% intervals,
and 90% intervals are narrower. But this makes perfect sense. If you want more confidence that
an interval contains the true parameter, then the intervals will be wider. If you want to be
100.000% sure that an interval contains the true population, it has to contain every possible value
so be very wide. If you are willing to be only 50% sure that an interval contains the true value,
then it can be much narrower..
what is IOT what us SolutionAns. IOT stands for Internet of Th.pdffathimafancy
What happens when a business is able to segment a market on the basis of needs, but unable to
demographically or behaviorally identify the segments?
Solution
There are four types of segmentation, which are demographic, geographic, psychographic and
behavioral. When a business is able to segment a market on the basis of needs, but unable to
demographically or behaviorally identify the segment, then the business will survive for a short
term only. The business would be able to fulfill the needs of their customers for a shorter span of
time, but it requires proper strategy and segmentation to be done to sustain and be succeed in a
long run..
What is the difference between a BSS and a ESSSolutionBSS sta.pdffathimafancy
what is IOT what us
Solution
Ans. IOT stands for Internet of Things: It is a connection of devices over internet to build
applications and services which will serve people needs.
It is a network of applications built over a planned structure to make human lives easy. It can
cover as small a need like an email protocol to as large a need as smart homes. With the advent
of internet and cloud technologies, it has a bright future ahead. It can be extended to army
services too..
What is the role of capsid and nucleocapsid proteins during the life.pdffathimafancy
What is the major difference between a hub and switch, which one is more efficient at routing
traffic, and which is preferable in larger network configurations?
Solution
The term\' Hub\' usually refers to a piece of network equipment which connects personal
computers together.This type of device carry forwards the information it receives so that it\'s
ports receive the information.Hubs repeat everything they receive and can be used to extend the
network.This can cause unnecessary traffic being send to devices in a network.This kind of
repeating is not a problem in the case of smaller networks but for larger traffic it becomes a
problem so we need to implement another network equipment called switch.
Switches control the netwok traffic by containing the address information of each packet and it
checks to which ports it has to send packets and sends on packets to relevant ports only.This
allows simultaneous communication across switch by improving bandwidth utilisation.
Hubs are used in smaller networks and are used to extend network by providing more number of
ports and switches divide the network into smaller and less blocked sections. Finally switches are
more efficient at routing traffic..
What distinguish between managerial and financial accounting as to (.pdffathimafancy
What are the similarities between internal and external agents? What are the differences?
Are all consultants change agents? Are all change agents consultants? When does a manager or
leader act as a change agent?
What about change is disruptive? How can meeting the challenge of change becaome
organizational opportunities?
Solution
Internal and external agents have similarities as they both act as change agents and want to bring
necessary change that can improve the organization and the organization can capitalize upon the
new opportunities. Though there are many differences between the internal and external agents.
Internal agents belong to the organization, whereas the external agent is hired as consultant by
the organization. An external agent will be the expertise upon the issues for that he or she is
hired, but an internal agent may not be the expert for the change management. External agent is
hired for a fixed period of time, but internal agent works for indefinitely for the organization.
Consultants are the people who hold expertise in particular areas, so the consultants can be hired
as change agent. But, they may not necessarily be used as change agent. All change agents may
not be consultants as internal resources such as managers and leaders within the organization,
can also act as a change management. When an organization wants to use internal agents for the
change process, then managers and leaders act as change management.
A disruptive change refers to the change in the organizational structure and process that creates
opportunities and make an old structure to be obsolete and irrelevant. Besides, the disruptive
change in fast and quick that unfreeze, redesign and refreeze the organization.
A change management brings the necessary change in the organizational structure and make the
organization to be adaptive to the new market conditions. While doing so, the organization
becomes lean and starts continuous scanning of the market conditions. It helps the organization
to capitalize on new opportunities on offer by the market environment..
There is a lack of spirituality in a person that cheats because they.pdffathimafancy
The Value Part
Comment on a service organization that provides for you. My favorite is the local hardware
store. They carry a ton of different items. I go in and ask for something and they normally carry
it and will sell me just the amount I need. Home Depot will sell me the item in a 100 unit box
when I only need 10 pieces.
Do service organizations add value to society? Well, according to the MA Dept of Revenue, over
85% of the persons who filed MA Income Taxes, their primary (largest) source of income came
from a service organization. Massachusetts would be in deep trouble financially if there were
only a few service organization were paying wages in this state.
Do you think the US economy needs service organizations?
Solution
With constant technological advancements and the increasing need of producing a steady stream
of revenue from ongoing contracts instead of having a single payment coming from a sold
manufactured product, more and more companies are adapting to the idea of transforming their
age-old traditional manufacturing business to a product-service system. The businesses are now
shifting to a subscription pricing model from the existing lump-sum one-time payment systems.
Talking about the servitisation of products, service industries such as hospitality, retail, banking,
health, information technology, education, etc. focus on service aspect of the business more than
the product aspect. These industries are mass employment providers and heavily invest in their
human capital. Service organisations make use of the skillset, knowledge, experience and talent
of their human resources to produce valuable outcomes for their customers. Whereas,
manufacturing organisations are accused of exploiting depleting natural resources by using them
as raw materials and in return, adversely affects the environment and adding to the prevailing
environmental issues such as pollution and global warming.
The importance of the service organisations in the US economy can be measured by the fact that
in the latest list of Fortune 500 companies, there are more number of service organisations than
number of manufacturers and product-based organisations in comparison to the fortune 500 lists
of past decades. Today, no company can boast of being just a product-based organisation.
Service has become an inseparable component of the product offering. As mentioned in the case,
according to the Massachusetts Department of Revenue, over 85% of the people who filed MA
income taxes had their primary income source coming from a service organisation. This shows
the huge employment opportunities that the service organisations have to offer in the economy.
There is no denying that the relative importance of service is increasing in the product offering of
many organisations. Take the example of IBM that treats its business as a service business
instead of a manufacturing business. Inspite of being in the business of manufacturing of
computers, the management of IBM over .
select the answer a general search engine differs from a subject di.pdffathimafancy
Section 2: Journal Entries (20 points) As of July 1, 2016, the City of Saratoga Springs decided to
purchase a privately operated swimming pool and to create a swimming pool fund. During the
year, the following transactions occurred: (a) $1,000,000 was borrowed with a note payable from
a local bank at an interest rate of 6%, (b) Purchased the following items in cash: a. Land b.
Building e. Land improvements $400,000 d. Equipment e. Supplies $300,000 $400,000
$200,000 $190,000 (c) Charges for services amounted to $600,000, all received in cash. (d)
Depreciation was recorded for the followings in the amounts specified below a. Building b. Land
improvements$40,000 c. Equipment $20,000 S20,000 1. In what fund does this need to be
accounted for? (Name the fund.) (4 points) When converted to government wide financial
statements, in which column should this fund be included? (4 points) Journal entries ( points
each)
Solution
SOLUTION:DebitCredit1Cash100,000Note payable100,0002Land300,000Building400,000Land
Improvement400,000Equipment200,000Supplies190,000Cash1,490,0003Cash600,000Operating
revenue- charge for services600,0004Operating expense-Depreciation80,000Accumulated
depreciation - Building20,000Accumulated depreciation - Land
Improvement40,000Accumulated depreciation - Equipment20,000.
State briefly what functions an Engineering Services Department in a.pdffathimafancy
Some of the major challenges to international expansion include all of the following except:
A. Political Risks
B. Unrelated diversification
C. Economic risks
D. Managerial Risks
Solution
The correct answer is option B.
Conducting business globally is very important and crucial decision made by the business and
require lots of effort and correct decisions in order to make it an effective move. It not only
provide new opportunities for growth and profit but also provide reputation to business globally.
There are several risk and challenges associated with doing business globally and a business
should consider these factors. These aspects are very important to consider when selecting an
international market to enter. They are:-
Unrelated diversification is nothing but the diversification when unrelated product lines and new
markets are added to current business. Example- Clothing manufacturer enters into watch
manufacturing business..
Satellites in geosynchronous orbit have the desirable property of re.pdffathimafancy
saplinglearning.com O.CHM.111.309A.SP18 Northern Virginia Community College,
Alexandria-CHM 111 - Spring Chlorine Jump to... 2/26/2018 12:00 AM O 3.6/5 ( 2/25/2018
10:17 PM Gradeboo Calculator IncorrectIncarrect -Print -d Periodic Table Question 11 of 13
Map Sapling Learning gas can be prepared in the laboratory by the reaction of hydrochiloric acid
with manganese(iy) oxide: You add 43.3 g of MnO2 to a solution containing 43.7 g of HCI. (a)
What is the limiting reactant? HC (b) What is the theoretical yield of Ch? Number 70.29 CI (c) If
the yield of the reaction is 763%, what is the actual yield of chlorine? Number 53.63 g CI Exit
ePrev ous Give Up & View Souton OCheck Answer ONect about us careers privacy policy e of
use contact us help
Solution
a) according to balanced reaction
4 x 36.5 g HCl reacts with 86.94 g MnO2
43.7 g HCl reacts with 43.7 x 86.94 / 4 x 36.5 = 26.02 g MnO2.
but we have 43.3 g MnO2. so MnO2 present in exess.
limiting reagent = HCl
limiting reagent = HCl
b) 4 x 36.5 g HCl gives 71 g Cl2
43.7 g HCl gives 43.7 x 71 / 4 x 36.5 = 21.25 g
therotical yield of Cl2 = 21.25 g
c) % yield = (actual yield / therotical yield) x 100
76.3 = (actual yield / 21.25) x 100
0.763 = actual yield / 21.25
actual yield = 16.21 g.
Research and discuss an incident where it was discovered that a Remo.pdffathimafancy
Requirement 1. Determine the maturity date and maturity value of each note. (For each
applicable note, compute interest using a 365-day year. Round to the nearest dollar.) Due date
Date Principal Amount Interest Rate Month/Day Year Maturity value Note (1) Apr. 1 (2) Sep. 30
Term Apr. 12019 20,000 22,000 16,000 13% 5% 11% 1 year 6 months Sep. 302019 Dec. 18
2018 Sep. 19 90 days Requirement 2. Jounalize the entries to establish each Note Receivable and
to record collection of principal and interest at maturity. Include a single adjusting entry on
December 31, 2018, the fiscal year-end, to record accrued interest revenue on any applicable
note. Explanations are not required. Round to the nearest dollar. (Record debits first, then credits.
Exclude explanations from journal entries.) Begin with the jounal entry to establish nate 1 Debit
Credit Date 2018 Apr. 1 Data Table Date Principal Amount Interest Rate Term 1 year 6 months
Note (1) Apr. (2) Sep. 30 20,000 22,000 16,000 13% 5% 11% Jcurnalize the entry to establish
note 2. Debit Credit Sep. 19 90 days Date 2018 Sep. 30 Accounts and Explanation PrintDone
Solution.
Please review the attached casescenario. You are Bill. Feel free to.pdffathimafancy
Please make sure it works I\'ve been struggling with this and so far every answer I\'ve got back is
wrong. l. Input an integer value altitude and use a loop to write your own graphics program
\'fall.cpp\' that produces a graphic representation of falling object (e.g. circle). An object has
initial downward velocity 0. Each second, it\'s velocity increases by 32 ft/sec Plot the descent of
the falling object. Note that terminal velocity is 174 ft/sec so the object\'s velocity cannot exceed
that speed. Now modify your program to read an integer variable secondstoopen to open a
parachute after n seconds. Assume the velocity decreases by 100 ft/sec after the chute opens until
the downward velocity hits 17 ft/sec. Note that outside the bottom of the loop is the code for
where the chutist has landed put a message there. (use C++ code please)
Solution
#include
#include
using namespace std;
void fuel(float & dist);
void distance(float dist, float & time, float & time2 );
void Altitude(float time, float time2, float altlevel);
void Climb_Descend(float altlevel);
int main(int argc, char *argv[])
{
float altlevel;
float dist;
int fuelcon;
float speed=300, altspeed;
char choice;
bool OK;
do
{
fuel(dist); //calls
distance(dist, speed, altspeed);
Altitude(speed, altspeed, altlevel);
Climb_Descend (altlevel);
cout <<\"do you want to calaculate again?\"<>choice;
if(choice==\'Y\' || choice==\'y\')
{
OK=true;
}
else
OK=false;
}
while (OK==true);
system(\"PAUSE\");
return EXIT_SUCCESS;
}
void fuel (float & dist) //function
{
cout<<\"Enter the distance of flight \"<>dist;
}
void distance(float dist, float & time, float & time2)
{
time = dist/300; // Speed is constant 300mph
time2 = (time - 0.30)*60; //30 minutes is needed to get to the top level
cout<< \" the flight will last \"<.
Please make sure it works Ive been struggling with this and so far.pdffathimafancy
Please help with this MIPS Assembly Language question! The task for a function named foo is
to increase the return value of the function bar (in register $v0) by 1 and return the result back to
the caller. The code of the function_foo is shown below: _foo: jal_bar addi $v0, $v0, 1 jr $ra
Assume that the function bar has been implemented. What is wrong with the function_foo
above? a. Nothing is wrong. b. Function _foo cannot use $v0. c. It will not go back to the
caller. d. The last instruction should be j $ra.
Solution
_foo: jal _bar //Jumps to the calculated address, and stored the return address in $ra.
addi $v0, $v0, 1 //Adds 1 to the value in $v0.
jr $ra //Jumps to address in register $ra.
So, nothing wrong with this function.
The answer is: a. Nothing is wrong..
Please explain the physiological mechanism for enlarged lymph nodes..pdffathimafancy
Please check. I am trying to fix the two errors but I don\'t know what I\'m doing wrong.
#include
#include
int main() {
char choice; // choice of user
int percentArray[50];
int percentage;
int count=0;
char LetterGrade;
for (count=0; count<50; count++){ //for loop to read the grades till array size
printf(\"-------------------Enter percentage---------------\ Add marks(a) \ Quit(q) \ \")
scanf choice
if(choice == \'a\'){ //if user choice is a, then read the grade
printf \"Enter grade:\";
scanf percentage;
percentArray[count] = percentage; //add the grade to array
}
if(choice == \'q\'){ //if the user choice is q, then exit the loop
break;
}
}
printf \"Grades are: \"
for (int i=0; i
Solution
#include
#include
int main()
{
char choice; // choice of user
int percentArray[50];
int percentage;
int count=0,i;
//char LetterGrade;
for(count=0; count<50; count++)
{ //for loop to read the grades till array size
printf(\"-------------------Enter percentage---------------\ Add marks(a) \ Quit(q) \ \");
scanf(\"%c\",&choice);
if(choice == \'a\')
{ //if user choice is a, then read the grade
printf( \"Enter grade:\");
scanf(\"%d\", &percentage);
percentArray[count] = percentage; //add the grade to array
}
if(choice == \'q\')
{ //if the user choice is q, then exit the loop
break;
}
}
printf(\"Grades are: \");
for(i=0; i.
multiple choiceAssuming that the probability for each shot is .pdffathimafancy
multiple choice
Assuming that the probability for each shot is independent, how many points, on average, can
jenny expect to make when she shoots a one-and-one ( when she only gets a second shot if she
makes the first)?
A. .96
B. 1
C. 2
D. .36
E. 0
Solution
Average = 1 × P( she makes the first shot but misses the second shot) + 2× P( she makes both the
shots)
Average = 1× 0.6 × 0.4 + 2× 0.6 × 0.6 = 0.96.
Mathematical Statistics.....Could answer be typed (is there any link.pdffathimafancy
Mathematical Statistics.....Could answer be typed (is there any link between the two and if so can
you discuss them)
Discuss the link, if any, between linear transformations and calculating probabilities.
Solution
Mathematical statistics
the application of mathematics to statistics
the answer can be uploaded in any manner as long as it is neatly uploaded and legible
or any mathematical tool can also be used to upload the answer or you can simply type your text.
Modify the Stack class given in the book in order for it to store do.pdffathimafancy
Modify the Stack class given in the book in order for it to store double numbers (instead of void*
pointers). Add a destructor that will delete all the stack by making calls to pop(), and for each
element destroyed the element will be printed to the output. Now add two constructors: the
default one that will create an empty stack, and another one that will receive an integer n and will
build a stack of n elements, such that the first element is 1.0, and the next ones are incremented
of 0.1. Upload your Stack class. It will be then tested for correctness with stacks.cpp.
Stack.h:
//: C05:Stack2.h
// Nested structs via linked list
#ifndef STACK2_H
#define STACK2_H
class Stack
{
struct Link {
void* data;
Link* next;
void initialize(void* dat, Link* nxt);
}* head;
public:
void initialize();
void push(void* dat);
void* peek();
void* pop();
void cleanup();
};
#endif // STACK2_H ///:~
Stack.cpp:
Sample Output:
2 1.5 1 0.5
1.3 1.2 1.1 1 end.
Solution
Hi, Please find my implemntation;
Please let me know in case of any issue.
//: C05:Stack2.h
// Nested structs via linked list
#ifndef STACK2_H
#define STACK2_H
#include
#include
using namespace std;
class Stack
{
struct Link {
double data;
Link* next;
void initialize(double dat, Link* nxt){
data = dat;
next = nxt;
}
};
Link *head;
public:
Stack(){
head = NULL;
}
Stack(int n){
for(double i=1; i<=n; i= i+ 0.1){
push(i);
}
}
~Stack(){
if(head != NULL){
while(head != NULL){
cout<data<<\" \";
Link *temp = head;
head = head->next;
delete temp;
}
cout<initialize(dat, head);
head = newNode;
}
double peek(){
if(head == NULL){
cout<<\"Stack is Empty!!!\"<data;
}
double pop(){
double d = -1;
if(head != NULL){
Link *temp = head;
d = temp->data;
head = head->next;
delete temp;
}else{
cout<<\"Stack is Empty!!!\"<.
Let V be a finite dimensional vector space over F with T element (V,.pdffathimafancy
Let V be a finite dimensional vector space over F with T element (V, V) and let U_1, ..., Um be
subspace of V that are invariant under T. Prove that U_1 + ... + U_m must also be an invariant
subspace of V under T.
Solution
If
v = u1 + · · · + uN U1 + · · · + UM
with un Un.
Then
Tv = Tu1 + · · · + TuN.
Since each Un is invariant under T,
Tun = Un, so Tv U1 + · · · + UM..
In the follwoing double bond hydration reaction styrene + water (so.pdffathimafancy
In the follwoing double bond hydration reaction: styrene + water (solvent) + H2SO4 (reagent) ---
-> 1-phenylethanol, what role does H2SO4 play?
a. it lowers the energy of activation.
b. it will deprotonate water.
c. it makes the reaction less exothermic.
d. it makest the reaction more exothermic.
I know that H2SO4 in this reaction catalyses the hydration of the double bond, but I do not fully
understand why. I believe the answer is a, but would appreciate correction/and or explanation
from someone with a better grasp of OChem! Thanks :)
Solution
a. it lowers the energy of activation
Once the H+ ion is attacking styrene, it will form a carbocation, it is an intermediate and its
activation energy will be less when campred with the starting material..
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Thesis Statement for students diagnonsed withADHD.ppt
Java programI made this Account.java below. Using the attached cod.pdf
1. Java program
I made this Account.java below. Using the attached code I need help with 10.7 (Game: ATM
machine)
Use the Account class created in Programming Exercise 9.7 to simulate an ATM machine.
Create ten accounts in an array with id 0, 1, . . . , 9, and initial balance $100.
The system prompts the user to enter an id. If the id is entered incorrectly, ask the user to enter a
correct id.
Once an id is accepted, the main menu is displayed as shown in the sample run.
You can enter a choice 1 for viewing the current balance, 2 for withdrawing money, 3 for
depositing money, and 4 for exiting the main menu.
Once you exit, the system will prompt for an id again. Thus, once the system starts, it will not
stop.
*/
import java.util.Date;
public class Account {
/**
* @param args
*/
private int id=0;
private double balance=0;
private double annualIntrestRate=0;
private Date dateCreated;
public Account() {
super();
}
public Account(int id, double balance) {
super();
this.id = id;
this.balance = balance;
2. }
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getAnnualIntrestRate() {
return annualIntrestRate;
3. }
public void setAnnualIntrestRate(double annualIntrestRate) {
this.annualIntrestRate = annualIntrestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public double getMonthlyInterestRate()
{
return (this.getAnnualIntrestRate()/12);
}
public double getMonthlyInterest()
{
return (getBalance() *getMonthlyInterestRate()/100);
}
public double withDraw(double balance)
{
this.setBalance(this.getBalance()-balance);
return this.getBalance();
}
public double diposite(double balance)
4. {
this.setBalance(this.getBalance()+balance);
return this.getBalance();
}
public double totalBalance()
{
balance =balance + getMonthlyInterest();
return balance;
}
}
//AccountTest.java
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
public class AccountTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
Account ac=new Account(1,5000.00);
System.out.println("Enter the annual intrest rate");
double intrestRate=sc.nextDouble();
ac.setAnnualIntrestRate(intrestRate);
Date d=new Date();
Calendar currentDate = Calendar.getInstance();
ac.setDateCreated(currentDate.getTime());
System.out.println("Date id "+ac.getDateCreated());
System.out.println("Monthly intrest rate is :"+ac.getMonthlyInterestRate());
System.out.println("Monthly intrest is :"+ac.getMonthlyInterest());
System.out.println("Enter Amount for diposite ");
double dipositeAmount=sc.nextDouble();
System.out.println("The amount after diposite is :"+ac.diposite(dipositeAmount));
5. System.out.println("Enter Amount to withdraw :");
double withdramount= sc.nextDouble();
System.out.println("The amount remain after with draw "+ac.withDraw(withdramount));
System.out.println("The total amount is "+ac.totalBalance());
}
}
/**
Sample output :
Enter the annual intrest rate
2.5
Date id Thu Mar 07 04:55:38 IST 2013
Monthly intrest rate is :0.208
Monthly intrest is :10.42
Enter Amount for diposite
300
The amount after diposite is :5300.0
Enter Amount to withdraw :
3000
The amount remain after with draw 2300.0
The total amount is 2304.79
*/
Solution
//Account.java
//Account represents the object of Account class
import java.util.Date;
public class Account {
/**
* @param args
*/
6. private int id=0;
private double balance=0;
private double annualIntrestRate=0;
private Date dateCreated;
public Account() {
super();
}
public Account(int id, double balance) {
super();
this.id = id;
this.balance = balance;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getAnnualIntrestRate() {
return annualIntrestRate;
}
public void setAnnualIntrestRate(double annualIntrestRate) {
this.annualIntrestRate = annualIntrestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
7. public double getMonthlyInterestRate()
{
return (this.getAnnualIntrestRate()/12);
}
public double getMonthlyInterest()
{
return (getBalance() *getMonthlyInterestRate()/100);
}
public double withDraw(double balance)
{
this.setBalance(this.getBalance()-balance);
return this.getBalance();
}
public double diposite(double balance)
{
this.setBalance(this.getBalance()+balance);
return this.getBalance();
}
public double totalBalance()
{
balance =balance + getMonthlyInterest();
return balance;
}
}
--------------------------------------------------------------------------------------------------------------------
----
/**
* The java program ATMSimulation that prompts user to enter
* an id number and re prompt if user id is not valid.
* Then prints the display menu that contains user choices.
* Then prints the correspoding output. Then repeats the
* menu.
* */
//ATMSimulation.java
import java.util.Scanner;
public class ATMSimulation {
8. public static void main(String[] args) {
//declare an array of type Account of size=10
final int SIZE=10;
Account[] accts=new Account[SIZE];
//set id and amount
for (int id = 0; id < accts.length; id++) {
accts[id]=new Account(id, 100.0);
}
Scanner scan=new Scanner(System.in);
int userId;
boolean repeat=true;
//Run the program
while(true)
{
do
{
//promot for user id
System.out.println("Enter your id number [0-9]: ");
userId=scan.nextInt();
if(userId<0 || userId>10)
System.out.println("Invalid id number.");
}while(userId<0 || userId>10);
//Get account into holder object
Account holder=accts[userId];
double amt=0;
repeat=true;
//repeat until user enter 4 to stop
while(repeat)
{
int choice=menu();
switch(choice)
{
case 1:
System.out.println("Balance : "+holder.totalBalance());
9. break;
case 2:
System.out.println("Enter amount to withdraw :");
amt=scan.nextDouble();
holder.withDraw(amt);
break;
case 3:
System.out.println("Enter amount to deposit :");
amt=scan.nextDouble();
holder.diposite(amt);
break;
case 4:
repeat=false;
break;
}
}
}
}
//Method menu display a menu of choices to users to select
private static int menu() {
Scanner scan=new Scanner(System.in);
int choice;
do
{
System.out.println("1.Viewcurrent balance");
System.out.println("2.Withdrawing money");
System.out.println("3.Depositing money");
System.out.println("4.Exit menu.");
choice=scan.nextInt();
if(choice<0 || choice>4)
System.out.println("Invalid choice");
}while(choice<0 || choice>4);
return choice;
}
10. }
--------------------------------------------------------------------------------------------------------------------
----
Output:
Enter your id number :
1
1.Viewcurrent balance
2.Withdrawing money
3.Depositing money
4.Exit menu.
1
Balance : 100.0
1.Viewcurrent balance
2.Withdrawing money
3.Depositing money
4.Exit menu.
3
Enter amount to deposit :
2500
1.Viewcurrent balance
2.Withdrawing money
3.Depositing money
4.Exit menu.
4
Enter your id number :
5
1.Viewcurrent balance
2.Withdrawing money
3.Depositing money
4.Exit menu.
1
Balance : 100.0
1.Viewcurrent balance
2.Withdrawing money
3.Depositing money
4.Exit menu.