Boudreaux’s Bill Payer Issue: Boudreaux needs help paying his bills each month.
ID: 3621485 • Letter: B
Question
Boudreaux’s Bill PayerIssue:
Boudreaux needs help paying his bills each month. He would like you to create a
program that asks him the date for which bills are due. Then it asks how many bills
Boudreaux has due that day. From there he would like to enter the bill amount for each of those bills. After he finishes giving the bill amounts he would like an itemized receipt so he can print it for his records. Boudreaux is trying to be good with his money.
Specifications:
Create a file named BoudreauxsBillPayer.java. This program should ask for a bill due
date using either a message box or scanner. After asking for the date the program will
then ask for how many bills are due that day. The user should be told they have a
maximum of five bills they can enter for one day. Using this information, the user will be able to enter each bill one at a time. After the last bill is entered, display an itemized list of the bills paid for that day. This list should include the due date, all the bill amounts and then a total for the day. The user should then be prompted to enter another date or exit.
Program Help:
• The solution to this problem requires nested loops. The outer loop can be a while
or do/while loop and the inner loop should be a for loop.
• Make sure the user entered a valid quantity of bills. There should be no less than
1 and no more than 5 bills entered. If they enter in an invalid number, tell them
and then return to the quantity of bills prompt.
• Assume the user will enter a proper bill amount. They won’t try to use characters
or something like 11.567.
• When the due date prompt is displayed, the user should also be given the option
to exit by typing in either an ‘E’ or ‘e’.
o HINT: use the stringVariable.charAt(0) function to achieve this
Explanation / Answer
import java.io.*; class BoudreauxsBillPayer { int n; int bill[]; String date[]; BufferedReader br; char ch; public static void main(String args[]) throws IOException { String dt; bill = new int[5]; date = new date[5]; br = new BufferedReader(new InputStreamReader(System.in)); do { System.out.println(" Enter Date :"); dt = br.readLine(); System.out.println(" Enter no. of bills(max 5)"); n = Integer.parseInt(br.readLine()); for(int i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.