Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Any help with this Java code would be appreciated. An upstart cell phone service provider would like you to write a program to generate cell

Any help with this Java code would be appreciated.

An upstart cell phone service provider would like you to write a program to generate cell phone bills. The company offers single plans and family plans, with the following rates: Single plan: $29.99 for the one line Family plan: $49.99 total for the first two lines Additional $22.00 for the third line Additional $12.00 for each additional line after that These monthly rates include unlimited talk and text, and 2 GB of data per phone line. Both plans charge $8.49 per GB for data overages. Implementation Requirements The program will be written in NetBeans. ? Create a new project named: Topic8project ? with a main class name of: CellPhoneBillGenerator Within your program code, you must: ? Include complete program description and author in the top of file comments ? Include comments above each defined method, including a method description and @param and @return tags for parameters and return values. ? Define and use constants for ALL fixed prices and the included GB per line (so there should be no hardcoded values in the program calculations). o Instead of defining all constants in the main method, each constant should be defined within the method that uses it From the main method: ? First display one line program description to the user. ? Then prompt for and read the following inputs from the user: o Customers plan type character: S for single plan or F for family plan, accepting both upper and lowercase letters. Tell the user how to enter the answer in the prompt. o Data usage: The number of GBs of data used by the customer in the past month (floating point value, not whole numbers). o Number of lines: ? For single plans, only 1 line is allowed, and no further input will be necessary ? For family plans, must read this input. A minimum of 2 lines will be on the plan, even if the user enters a lower number. The program should adjust the value for the number of lines, as necessary.

? After reading the necessary inputs from the user, call the four methods described below. When the called method returns a value, be sure to store the value returned from the method in a main method variable for later use. ? Method 1: a method to determine the rate for the plan. o Method will have one input parameter: the number of lines on the plan o Method will use the number of lines to determine the monthly rate for the plan o Method will return the plans monthly rate ? Method 2: a method to determine the data overage charge for the plan. o Method will have two input parameters: the number of lines on the plan, and the data used by the plan for the current month o The method should round the data used UP to the nearest whole GB, and then calculate the charges ? NOTE: Charges will be 0.00 when customers do not go over their included data o Method will return the data overage charge ? Method 3: a method to display a plan/usage summary o Method will have two input parameters: the number of lines on the plan, and the data used by the plan for the current month o Method will display 2 blank lines first o Method will display plan/usage summary, formatted as shown below ? All details should line up on the right with the last character in position 30 ? Plan type should be displayed as a String (single or family) ? Data usage should be displayed rounded to 1 decimal place and include the units ? Method 4: a method to display the charges o Method will have two input parameters: the plans monthly rate and the data overage charge o Method will display 1 blank line first o Method will display the plan rate and overage charges, along with a total, formatted as shown below

PLAN/USAGE SUMMARY Plan: single Number of lines: 1 Data usage: 2.5 GB CHARGES Plan rate 29.99 Data overage charges 8.49 ------- Total bill 38.48

Summary & Charges Output for Sample Run 2 (family plan with multiple lines and low data usage):

you if you passed or failed the test. PLAN/USAGE SUMMARY Plan: family Number of lines: 3 Data usage: 5.5 GB CHARGES Plan rate 71.99 Data overage charges 0.00 ------- Total bill 71.99

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions