Question

Analyze a family's spending habits by creating a program that performs arithmetic calculations. The program should...

Analyze a family's spending habits by creating a program that performs arithmetic calculations. The program should ask the user to enter information for the following questions. How much does the family spend on groceries per month?

How much does the family spend on dining out per month?

How much does the family spend on entertainment per month?

How much does the family spend on rent/mortgage per month? How much does the family spend on utilities per month?

How many family members are there?

What is the family income per year?

Questions 1–5 and 7 should accept decimal values from the user. Question 6 should accept an integer from the user. The program should output the total amount that the family spent on food per month. This includes groceries and dining out. The program also needs to output the total amount spent on living expenses each month. This is the sum of rent/mortgage and utilities. The program should also display the entertainment expenses per person per month. Finally, the program needs to show the family surplus (deficit if the number is negative). This is the income minus all expenses. But remember that the expenses are input as monthly numbers and the income is yearly, so you will need to convert the monthly expenses to yearly numbers to calculate the surplus.

Check out the two samples input and outputs below. Remember, ">>" indicates user input.

Use Java language with examples, please.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;

public class FamilySpending {

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.print("How much does the family spend on groceries per month?");
double grocery_month=input.nextDouble();
System.out.println("How much does the family spend on dining out per month?");
double dining_month=input.nextDouble();
System.out.println("How much does the family spend on entertainment per month?");
double entertainment_month=input.nextDouble();
System.out.println("How much does the family spend on rent/mortgage per month?");
double rent_month=input.nextDouble();
System.out.println("How much does the family spend on utilities per month?");
double utilities_month=input.nextDouble();
System.out.println("How many family members are there?");
int number_family=input.nextInt();
System.out.println("What is the family income per year?");
double family_income=input.nextDouble();
System.out.println("Total food expenses each month = "+(grocery_month+dining_month));
System.out.println("Total amount spent on living expenses each month = "+(rent_month+utilities_month));
System.out.println("Entertainment expenses per person per month = "+(entertainment_month/number_family));
double total_expense=grocery_month+dining_month+entertainment_month+rent_month+utilities_month;
double income_month= (family_income/12.0);
double defict=income_month-total_expense;
System.out.println("Surplus/Deficit is: "+ defict);


}

}

Add a comment
Know the answer?
Add Answer to:
Analyze a family's spending habits by creating a program that performs arithmetic calculations. The program should...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • Assignment 1 Create a monthly budget using Excel. Each of the rows should represent days in...

    Assignment 1 Create a monthly budget using Excel. Each of the rows should represent days in the month: 1st, 2nd, 3rd, etc. with the last row titled “Total.” Each of the columns should represent areas in which you spend money: groceries, restaurants, utilities, entertainment, school/work, car, shopping, misc., etc. At the bottom of each column on the Total row, use a SUM formula to add all of the rows for the whole month so that you can track your spending...

  • 7. Preparing a cash budget Brock and Sam started to create a budget (based on last...

    7. Preparing a cash budget Brock and Sam started to create a budget (based on last year’s income and expense statement) but got stuck. They know that you have learned how to create budgets and are asking for your help. They would like you to input the correct values for the first three months of next year. Income and Expense Statement Name(s): Brock and Sam Wilson For the year ending: As of December 31 Dollars Income Wages and salaries Name:...

  • 7. Preparing a cash budget Dan and June started to create a budget (based on last...

    7. Preparing a cash budget Dan and June started to create a budget (based on last year’s income and expense statement) but got stuck. They know that you have learned how to create budgets and are asking for your help. They would like you to input the correct values for the first three months of next year. Income and Expense Statement Name(s): Dan and June Kuryaki For the year ending: As of December 31 Dollars Income Wages and salaries Name:...

  • Excel Budget Assignment THE BOB STORY.. Using the Excel Budget Spreadsheet as a guide, fill in...

    Excel Budget Assignment THE BOB STORY.. Using the Excel Budget Spreadsheet as a guide, fill in the values below for each respective category. Answer the questions following each scenario in the "Excel Budget Assignment quiz. Bob has trouble managing Bob Meets Smart Sally They fall in love and get mad budget for them as the wedding gift Income: Bob earns a monthly net income of $160.00 for finding earthworms. Smart Sally earns a monthly net income of $6245.00 as a...

  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • Based on her spending in the previous month, Ashley needs to cut $500 per month from...

    Based on her spending in the previous month, Ashley needs to cut $500 per month from her budget. Look at Ashley's budget and decide what she should cut, and explain why there is room for her to cut her budget in that way. Governments have to go through the same process in balancing budgets, though of course on a much larger scale. Item Rent Groceries for meals Snacks Personal grooming Dining out Amount Budget Amount Reason she can make cuts:...

  • For this project, you are tasked with creating a text-based, basic String processing program that performs...

    For this project, you are tasked with creating a text-based, basic String processing program that performs basic search on a block of text inputted into your program from an external .txt file. After greeting your end user for a program description, your program should prompt the end user to enter a .txt input filename from which to read the block of text to analyze. Then, prompt the end user for a search String. Next, prompt the end user for the...

  • What is budgeting?

    What is budgeting? (A) Having money left over at the end of the month. (B) A plan made in advance regarding the expenditure of money based on available income. (C) The ability to pay your bills on time. (D) Having enough money to go out to eat.2. Which of the following is an example of a "fixed expense'? (A) Food and groceries. (B) Mortgage or rent payments. (C) Charitable contributions. (D) Gas for your car.3. What is discretionary income? (A)...

  • drop down for B. choices are income/expense,income/expense, surplus/deficit Income statement preparation Adam and Arin Adams have...

    drop down for B. choices are income/expense,income/expense, surplus/deficit Income statement preparation Adam and Arin Adams have collected their personal income and expense information and have asked you to put together an income and expense statement for the year ended December 31, 2019. The following information is received from the Adams family a. Create a personal income and expensestament for the period ended December 31, 2019 should be similar to a corporate income statement b. Did the Adams family have a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT