Question: Decision or Selection Structures and Loops ( Decision Tree: If - else if - else loop ) The charges for Wireless for one of the
Decision or Selection Structures and Loops
Decision Tree: If else if else loop The charges for Wireless for one of the mobile companies is given in the following table. Use if else if else decision structure.
Plan
Allowed Data Per User
Monthly Charges per user
Plan
Less than GB
$
Plan
Less than GB
$
Plan
Less than GB
$
Unlimited
Greater than or equal to GB
$
Write a JAVA method to calculate the annual charges fine calcAnnChargeFirstname called from main.
The variables in the program should be named as shown below and should be input by the user:
expectedDataUsagefirstnameExpected data usage per user in the household int data type
numUsersfirstname Number of users in the household int Data type
taxpctfirstname A double data type This is the tax percentage on the invoice. Tax is applied on the overall calculated charges.
The program also should display the following message for each of the above cases as shown in the table below:
Allowed Data Per User
Message
Less than GB
You are on Plan and can use upto GB per month per user
Less than GB
You are on Plan and can use upto GB per month per user
Less than GB
You are on Plan and can use upto GB per month per user
Greater than or equal to GB
You are on Unlimited plan and Enjoy unlimited data for all users
Your method should calculate the Annual total charges per household including the taxes and also should do the display.
Charges should be calculated using an if else if else decision structure and make it more efficient by not repeating code as much as possible.
The Message from the above table should be displayed using a Switch Case decision structure.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
