Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I provided 90 % of the program code for you in java. I need the program modified to print out the full name at the

I provided 90 % of the program code for you in java.

I need the program modified to print out the full name at the end of the program.

while loops validate user input properly

Calculate costs for all three plans and save them in three variables which can be used for cost comparison. So if i bought plan a, display the amount of money you would save if bought plan b and c etc.

image text in transcribed

loop to display the 96 characters starting from the space character ' '. Display 16 characters on each line with one space between characters

image text in transcribed

import java.util.Scanner;

// define our class

public class BCS345hw1 {

public static void main(String[] args) {

// declare all variables

char phonePlan String fullName;

double minutesUsed;

double totalCharges = 0;

// create keyboard for the Scanner class

Scanner keyboard = new Scanner(System.in);

// menu that will display to the user about the type of phone plan to choose from

System.out.println(" Mobile Phone Service Plan");

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

System.out.println("Plan A: $39.99 per month. 450 free minutes. Additional usage costs $0.45 per minute.");

System.out.println(" Plan B: $59.99 per month. 900 free minutes. Additional usage costs $0.40 per minute.");

System.out.println(" Plan C: $69.99 per month. Unlimited minutes. ");

// prompts the user to enter their full name

System.out.print(" Please enter your full name: ");

fullName = keyboard.next().charAt(0);

// while loop that checks for user data validation

while (fullName == ' ') {

// if first name is null you will get this error message

System.out.println(" Thats not possible, try again: ");

fullName = keyboard.input.next();

}

// prompt the user to enter the package purchased

System.out.print("Which mobile service plan was purchased? (A,B, or C)? : ");

phonePlan = keyboard.next().charAt(0);

// while loop that test for data input validation

while (phonePlan != 'A' && phonePlan != 'a'

&& phonePlan != 'B' && phonePlan != 'b'

&& phonePlan != 'C' && phonePlan != 'c') {

// error message if your input doesnt match the cases for the phone plan

System.out.println(" You have entered the wrong phone plan "

+ "The package should be A or B or C only.");

phonePlan = keyboard.next().charAt(0);

}

// prompts the user to enter the amount of minutes used from last month

System.out.print("How many minutes did you use last month? :");

minutesUsed = keyboard.nextInt();

//while loop that checks user input if its negative

while (minutesUsed

//error message if minutes is negative

System.out.print("Error, minutes cant be negative :");

minutesUsed = keyboard.nextInt();

}

switch (phonePlan) {

case 'A':

case 'a':

// if package A was bought

if (minutesUsed

totalCharges = 39.99;

} else {

totalCharges = 39.99 + (0.45 * (minutesUsed - 450));

}

break;

case 'B':

case 'b': // if package B was bought

if (minutesUsed

totalCharges = 59.99;

} else {

totalCharges = 59.99 + (0.40 * (minutesUsed - 900));

}

break;

case 'C':

case 'c':

// if package C was bought

totalCharges = 69.99;

break;

default: //if an invalid package is selected

System.out.println(" You have entered wrong option for package "

+ "The package should be A or B or C only.");

} // end switch

System.out.println(" Monthly Statement for " + fullName);

System.out.printf("Plan " + phonePlan + " Minutes used: " + "%.2f", minutesUsed);

System.out.println(" The charges are:" + " $" +totalCharges);

}

}

Monthly Statement for Alice Brown Plan - Minutes used: 555.00. The charges are $87. 24. By switching to Plan B you would save $27. 25. By switching to Plan C you would save $17.25. Task2: 0 1 2 3 4 5 6 7 8 9 ::-> ? ABCDEFGHIJKLMNO PQRSTUVTXYZ ". abcdefghijklmno DGI Stuvy: (1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Zero To Data Hero With Chatgpt

Authors: Andrew Wu

1st Edition

B0CQRJPXD9, 979-8989523009

More Books

Students also viewed these Databases questions

Question

Describe a persuasive message.

Answered: 1 week ago

Question

Identify and use the five steps for conducting research.

Answered: 1 week ago

Question

List the goals of a persuasive message.

Answered: 1 week ago