Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Programming and Logic I Budget Assignment Create a program called Budget

Programming and Logic I Budget Assignment Create a program called Budget

Computer Science

Programming and Logic I Budget Assignment Create a program called Budget.java. My program would be ConwayBudget.java and my class name would be ConwayBudget. All the input from the user should be from the command line (use the Scanner object). You only need to create one Scanner object to handle all the input. Do not use JOptionPane. This program will simulate entering values for a monthly budget. It will total the user’s expenses for the month and then indicate whether the user went over budget. The program will not know how many values the user will enter. The user will enter the sentinel value of -1 when the user has completed entering expenses. The program will utilize a while loop to keep a running total of expenses. (Use a while loop; do not use a do-while loop.) Before the loop begins, prompt the user for the first expense (this is called a priming read). Within the loop, add the expense to the running total. Then prompt the user for the next expense. The program will also need to keep track of the number of expenses the user enters. This can be accomplished by using a variable that is incremented by 1 within the loop. The user will enter the value -1 when there are no more expenses to enter. This sentinel value of -1 will terminate the loop. The loop condition must be constructed to check for the sentinel value. When the loop has completed, the program will print to the screen the total budgeted for the month, the number of expenses, and expense total, and whether the user was under, at or over budget. Notes: • Use a “priming read” before the loop begins. See code on page 220 for an example. • Several int variables (for expense total, expense count) will be needed for the program to run properly. Initialize these variables to appropriate values before the loop begins. • The loop should handle testing the condition. There is no need to test for the sentinel using an if statement. • The user can enter -1 as the first value if there are no expenses to enter. The loop should not be entered in this case. Make sure to test for this. • Test the program! Use the values sh

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE