Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an application that collects information for two separate accounts for an

ID: 3748603 • Letter: W

Question

Write an application that collects information for two separate accounts for an individual

Programming Assignment #1 Assignment Objective Write a Java application with a class name of MyAccounts, to collect and output information on a user. Task(s) Task 1: Write an application that collects information for two separate accounts for an individual The application should prompt for the first and last name of the individual; stored in two separate 'String' variables. The application should prompt for the account information for two separate user accounts. o Account Name, stored in a 'String' variable o Account Number, stored in a 'integer variable o Account Limit, stored in a 'double' variable Account Balance, stored in a 'double' variable Task 2: Compute the average balance for the two separate accounts Task 3 Output the information for the individual user Output the first and last name separated by a comma; last name, first name Output each user account name, number, limit, balance and availability Task 4: Output the user average balance Output a rating based on the average balance o If the average account balance is below $1000, output "Awesome" o If the average account balance is below $2500, output "Good Job" o Otherwise, output "Help" Notes Do not use any loops or arrays Use the Scanner class to input values The Application should read the appropriate information from the keyboard Enter User First NameStephen Enter User Last Name Foster Enter Account 1 Name : Sears Enter Account 1 Number 192948 Enter Account 1 Limit 10000 Enter Account 1 Balance: 1575.44 Enter Account 2 Name : L wes Enter Account 2 Number: 124552 Enter Account 2 Limit : 2500 Enter Account 2 Balance: 342.76 The Application should output the data in readable format Foster, Stephen Account Sears Lowes Number 192948 124552 Limit Balance 1575.44 $ Available 8424.56 2157.24 10000.00 $ 2500.00 $ 342.76 $ Average Balance: $959.10 Awesome]

Explanation / Answer

import java.util.Scanner;

public class AccountDemo {

public static void main(String[] args) {
//Scanner variable
Scanner in =new Scanner(System.in);
System.out.println("Enter User First Name:");
String fn=in.nextLine();
System.out.println("Enter User Last Name:");
String ln=in.nextLine();
System.out.println("Enter Account1 Name:");
String ac1=in.nextLine();
System.out.println("Enter Account1 Number:");
int acn1=in.nextInt();
System.out.println("Enter Account1 Limit:");
double acnlim1=in.nextDouble();
System.out.println("Enter Account1 Balance:");
double acnbl1=in.nextDouble();
//Use this to flush the things
in.nextLine();
System.out.println("Enter Account2 Name:");
String ac2=in.nextLine();
System.out.println("Enter Account2 Number:");
int acn2=in.nextInt();
System.out.println("Enter Account2 Limit:");
double acnlim2=in.nextDouble();
System.out.println("Enter Account2 Balance:");
double acnbl2=in.nextDouble();

//Output
System.out.println(fn+", "+ln);
System.out.println("Account Number Limit Balance Available");
System.out.println(ac1+" "+acn1+" "+"$"+acnlim1+" "+acnbl1+" "+(acnlim1-acnbl1));
System.out.println(ac2+" "+acn2+" "+"$"+acnlim2+" "+acnbl2+" "+(acnlim2-acnbl2));
double avg=(acnbl1+acnbl2)/2;
System.out.print("Average Balance : $"+avg);
iif(avg<2500)
System.out.println(" Good Job");
else if(avg<1000)
System.out.println(" Awesome");
else
System.out.println(" Help");
}
  
}

Output:

Enter User First Name:

Stephen

Enter User Last Name:

Foster

Enter Account1 Name:

Sears

Enter Account1 Number:

192948

Enter Account1 Limit:

10000

Enter Account1 Balance:

1575.44

Enter Account2 Name:

Lowes

Enter Account2 Number:

124552

Enter Account2 Limit:

2500

Enter Account2 Balance:

342.76

Stephen, Foster

Account Number Limit Balance Available

Sears 192948 $10000.0 1575.44 8424.56

Lowes 124552 $2500.0 342.76 2157.24

Average Balance : $959.1 Good Job

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote