Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design a class that calculates a customer's monthly bill. It should store the letter of the package the customer has purchased ( A , B
Design a class that calculates a customer's monthly bill. It should
store the letter of the package the customer has purchased A B or
C and the number of minutes that were used. It should have a method
that returns the total charges. Demonstrate the class in a program
that asks the user to select a package and enter the number of minutes
used. The program should display the total charges
MobileCharges
PACKAGEIDENTIFIERA: char A
PACKAGEIDENTIFIERB: char B
PACKAGEIDENTIFIERC: char C
PURCHASEPRICEA : double
PURCHASEPRICEB : double
PURCHASEPRICEC : double
MINUTESPROVIDEDA : double
MINUTESPROVIDEDB : double
MINUTESPROVIDEDC : double
PRICEPERMINUTEA : double
PRICEPERMINUTEB ; double
PRICEPERMINUTEC : double
packageldentifier : char
minutesUsed ; double
minutesProvided : double
pricePerMinute : double
purchasePrice : double
additionalMinutes : double
additionalCharges ; double
totalCharges : double
MobileCharges; char, ; double
setPackageldentifierp : char : void
setMinutesUsedm : double : void
getPackageldentifier : char
getMinutesUsed : double
getMinutesProvided ; double
getPricePerMinute : double
getPurchasePrice : double
getAdditionalMinutes : double
getAdditionalCharges: double
getTotalCharges : double
assuming that the Class MobileCharges is complete and filled out
create MobileChargesDemo so the Java project can actually carry out what it's supposed to do with this template
Template MobileChargesDemo
import java.text.DecimalFormat; For the DecimalFormat class
import java.util.Scanner; For the Scanner class
public class MobileChargesDemo
public static void mainString args
String input; To hold a line of input
char packageChr; To hold the package identifier
double minutes; To hold the number of minutes
Create a Scanner object for keyboard input.
Scanner keyboard new ScannerSystemin;
Get the package.
System.out.printEnter the package the customer has purchased A B or C: ;
input keyboard.nextLine;
packageChr input.charAt;
packageChr Character.toUpperCasepackageChr;
Validate the package indentifier.
Add your code
Add your code
Add your code
Add your code
Add your code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started