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

construct an object at this stagé. A wireless telephone company has some options

ID: 3880946 • Letter: C

Question

construct an object at this stagé. A wireless telephone company has some options for new customers. Three of them are the following: (1) Buy the phone for $200 and sign a contract for two years witha monthly charge of $9%, (2) Lease the phone for $600 by paying $144 per month with an option to buy the phone. The $144 will include the lease amount and monthly phone charges. The purchase price after two years is S100. (3) Buy the phone for $60 per month without a two-year contract. Write a program to implement it with proper messages. The program should educate the user by showing the total cost at the end of two years, for comparison. The user should be able to choose one of the options and based on that, the program should print the total cost for two years. $600 and pay Write a program to calculata ^ …-

Explanation / Answer

I have created the Java program. If you don't understand anything or if the program is not as per the requirements do let me know in the comments section.

Wireless.java

public class Wireless {

public static void main(String[] args) {

printMenu();

Scanner scan = new Scanner(System.in);

int choice = scan.nextInt();

while(choice != 9) {

if(choice > 9) {

System.out.println("You have entered invalid option. Please try again !! ");

printMenu();

choice = scan.nextInt();

} else {

if(choice == 1) {

printOne();

printMenu();

choice = scan.nextInt();

} else if(choice == 2) {

printTwo();

printMenu();

choice = scan.nextInt();

} else if(choice == 3) {

printThree();

printMenu();

choice = scan.nextInt();

} else {

System.out.println("You have entered invalid option. Please try again !! ");

printMenu();

choice = scan.nextInt();

}

}

}

System.out.println("Thank you for visiting wireless telephone company!!");

scan.close();

}

private static void printMenu() {

System.out.println("----------------------------------------");

System.out.println("Welcome to wireless telephone company");

System.out.println("Press 1 to Buy a phone with contract");

System.out.println("Press 2 to Lease a phone with the option of buying");

System.out.println("Press 3 to Buy a phone without contract");

System.out.println("Press 9 to exit the system");

System.out.println("Please Enter Your Choice");

}

private static void printOne() {

int costOfPhone = 200;

int monthlyCharges = 96;

int contractTenure = 24;

System.out.println("----------------------------------------");

System.out.println("You have selected option 1 - Buy a phone with contract");

System.out.println("Cost of Phone: $"+costOfPhone);

System.out.println("Monthly Charges: $"+monthlyCharges);

System.out.println("Contract Tenure: "+contractTenure+" Months");

System.out.println("Total Cost: $"+(costOfPhone + (contractTenure*monthlyCharges))+" (at the end of "+contractTenure/12+" Years)");

System.out.println("----------------------------------------");

}

private static void printTwo() {

int costOfPhone = 600;

int leasePeriod = 24;

int monthlyCharges = 144;

System.out.println("----------------------------------------");

System.out.println("You have selected option 2 - Lease a phone with the option of buying");

System.out.println("Cost of Phone: $"+costOfPhone);

System.out.println("Lease Period: "+leasePeriod+" Months");

System.out.println("Monthly Charges: $"+monthlyCharges);

System.out.println("Cost of Phone: $"+100+" (after 2 years)");

System.out.println("Total Cost: $"+monthlyCharges*24+" (at the end of 2 years without buying the phone)");

System.out.println("Total Cost: $"+((monthlyCharges*24)+100)+" (at the end of 2 years with buying the phone)");

System.out.println("----------------------------------------");

}

private static void printThree() {

int costOfPhone = 600;

int monthlyCharges = 60;

System.out.println("----------------------------------------");

System.out.println("You have selected option 3 - Buy a phone without contract");

System.out.println("Cost of Phone: $"+costOfPhone);

System.out.println("Monthly Charges: $"+monthlyCharges);

System.out.println("Total Cost: $"+((24*monthlyCharges)+costOfPhone)+" (at the end of 2 years)");

System.out.println("----------------------------------------");

}

}