Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java please Cell Phone Bill Report Prompt the user for their name and the year and store their answers Generate a cell phone annual

in java please

Cell Phone Bill Report

Prompt the user for their name and the year and store their answers

Generate a cell phone annual report that:

Displays the cell phone bill amount for all 12 months (using the data in the cellPhoneBill and month arrays that are provided in the file)

Counts & displays the number of cell phone bills that were over $50.00

Find & display both the highest and lowest cell phone bills over the year

Calculates the total cell phone bill for the entire year (all 12 months)

You should use loops to complete each part of #4. It is possible (but not required) to do more than one part of #4 in a single loop, but it is perfectly fine to have one loop for each part of #4.

You should format your output using NumberFormat (see notes in the Canvas assignment) Your output should look similar to the following:

Welcome Valued Customer!

Please enter your name: Charlie Duke

Please enter the year: 2020

2020 Annual Cell Phone Report for Charlie Duke

-----------------------------------------

JAN: $45.24

FEB: $54.67

MAR: $43.66

APR: $55.32

MAY: $67.19

JUN: $44.61

JUL: $65.29

AUG: $49.75

SEP: $43.21

OCT: $44.67

NOV: $56.99

DEC: $64.34

Monthly bills >$50.00: 6

Highest monthly bill : $67.19

Lowest monthly bill : $43.21

Annual bill for 2020 : $634.94

-----------------------------------------

Copy the entire loop from 4a where you print the bill from each month:

Copy the entire loop from 4b where you count the number of bills over $50

Copy the entire loop from 4c where you find the highest & lowest bills

Copy the entire loop from 4d where you calculate the total annual bill

package projects.project7phonebill;

import java.text.NumberFormat;

import java.util.Scanner;

public class CellPhoneBillReport {

public static void main(String[] args)

{

Scanner scnr = new Scanner(System.in);

NumberFormat cFmt = NumberFormat.getCurrencyInstance();

String name= "";

String year = "";

double[] cellPhoneBill = {45.24, 54.67, 43.66, 55.32, 67.19, 44.61,

65.29, 49.75, 43.21, 44.67, 56.99, 64.34};

String[] month = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN",

"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};

double highestBill = 0;

double lowestBill = 0;

double totalBill = 0;

int countHigh = 0;

double highMark = 50.00;

System.out.println("Welcome Valued Customer");

System.out.println(" Annual Cell Phone Report for " + name);

for(int x = 0; x < name.length() + 29; x++)

System.out.print("-");

System.out.println();

for(int x = 0; x < name.length() + 29; x++)

System.out.print("-");

System.out.println();

scnr.close();

}

}

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

More Books

Students also viewed these Databases questions

Question

Describe the three types of start-up firms.

Answered: 1 week ago

Question

How to solve maths problems with examples

Answered: 1 week ago