Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program prompts a person for income and expense amounts, then calculates their net monthly income. Unlike previous assignments, this programs behavior is dependent on

This program prompts a person for income and expense amounts, then calculates their net monthly income. Unlike previous assignments, this programs behavior is dependent on input from a user (user input is bold and underlined below). Your output should match our examples exactly when given the same input, but If the input changes, the output will also. Additional execution logs will be posted on the course website, and you can use the Output Comparison Tool to check your output for various inputs. Make sure that the format and structure of your output exactly match the given logs. Expected Output #1 This program asks for your monthly income and expenses, then tells you your net monthly income. How many categories of income? 3 Next income amount? $1000 Next income amount? $250.25 Next income amount? $175.50 Enter 1) monthly or 2) daily expenses? 1 How many categories of expense? 4 Next expense amount? $850 Next expense amount? $49.95 Next expense amount? $75 Next expense amount? $120.67 Total income = $1425.75 ($45.99/day) Total expenses = $1095.62 ($35.34/day) You earned $330.13 more than you spent this month. You're a big saver. << Your custom message goes here >> The program begins with an introductory message that briey explains the program, then prompts the user for the number of income categories and reads in that many income amounts. Next, the program asks whether the user would like to enter monthly or daily expenses. (The user enters 1 for monthly and 2 for daily.) The program will then read in a number of expense categories and an amount for each category, similar to how income was read. After reading all the user input, the program should then print out the total amount of income and expenses for the month, as well as the average income and expense per day. You may assume a month has exactly 31 days, though you should use a class constant so that your program can be easily modied to change this assumption(see below). The program should print out whether the user spent or earned more money for the given month and by how much. If income and expenses were exactly equal, the user is considered to have spent $0 more than they earned (as opposed to earning $0 more than they spent). Finally, the program should print out which category the user falls into based on their net income for the month, where the net income is the result of subtracting the users expenses from their income. The category should be followed by a custom message of your choice about the users spending habits. This message must be dierent for each of the four ranges shown below, and should consist of at least one line of any non-oensive text you choose. Each category must have a separate, unique message. The categories are dened below. You may nd this graphic helpful in understanding the boundaries of the various categories. Net income range Category More than +$250 big saver More than $0 but not more than than +$250 saver More than -$250 but not more than $0 spender -$250 or less big spender Page 1 of 4 All monetary values in output should be rounded to two decimal places. This can be achieved either using a rounding method (as shown in lecture) or using System.out.printf either approach is acceptable. If the second digit after the decimal point (the "hundreths" digit) is a zero, your program may or may not print out this zero, as long as it is consistent in all cases. You MUST print out two digits if the second digit is not a zero.

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_2

Step: 3

blur-text-image_3

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions