1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
goldfiish [28.3K]
2 years ago
14

16. Budget Analysis Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop shoul

d then prompt the user to enter each of his or her expenses for the month, and keep a running total. When the loop finishes, the program should display the amount that the user is over or under budget.
Computers and Technology
1 answer:
strojnjashka [21]2 years ago
6 0

Answer:

import java.util.Scanner;

public class num8 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter month's budget");

       double monthBudget = in.nextDouble();

       double totalExpenses = 0.0;

       double n;

       do{

           System.out.println("Enter expenses Enter zero to stop");

           n = in.nextDouble();

           totalExpenses += n;

       }while(n>0);

       System.out.println("Total expenses is "+totalExpenses);

System.out.println("The amount over your budget is "+ Math.abs(monthBudget-totalExpenses));

   }

}

Explanation:

  • Using Java programming language
  • Prompt user for month's budget
  • Use Scanner class to receive and store the amount entered in a variable
  • Use a do while loop to continuously request user to enter amount of expenses
  • Use a variable totalExpenses to add up all the expenses inside the do while loop
  • Terminate the loop when user enters 0 as amount.
  • Subtract totalExpenses from monthBudget and display the difference as the amount over the budget

You might be interested in
Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a d
Rudik [331]

Answer:

import java.io.*;

public class Main {

   public static void main(String[] args) throws IOException {

       double baseLength = 0, baseWidth = 0, pyramidHeight = 0;

       Object[] volume;

       volume = calcPyramidVolume(baseLength, baseWidth, pyramidHeight);

   }

   public static Object[] calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight) {

       double area = calcBaseArea(baseLength, baseWidth);

       double volume = baseLength * baseWidth * pyramidHeight;

       return new Object[]{volume, area};

   }

   public static double calcBaseArea(double length, double width) {

       return length * width;

   }

}

Explanation:

The problem is flawed because it is completely inefficient for one to create two separate methods to calculate the volume and the area when they can be done at once.

The second problem is that it was never specified whether to return something from the calcBaseArea method.

I assumed it required it, so it is not advisable to initiate the method as a double, but rather create it as an Object so that it can return two values: the volume and the area.

6 0
3 years ago
Which invention provided instant communication and information to a massive audience for the first time?
igor_vitrenko [27]
B. Television. It provided <span>instant communication and information to a massive audience for the first time in 1927.

Hope this helps :)</span>
4 0
2 years ago
Read 2 more answers
Match each type of option on the left with a corresponding function on the right.
Marta_Voda [28]

Answer:

yes. the above is correct

Explanation: q posted

7 0
2 years ago
The following are a set of named spreadsheets with the indicated column headings. Use these spreadsheets to answer exercises 1.3
Dovator [93]

Answer:

There are five work sheets in this excel file, they are equipment, company, company, person and computer. Excel worksheets are made up of cells, with the columns labelled alphabetically and the rows numbered.

Explanation:

The columns of a worksheet is called a field while row are called records. They are used to locate a cell in the worksheet. There are so many statistical, mathematical and engineering functions in excel. It is used to display the analysis of data.

7 0
3 years ago
Most organizations use a(n) ____ form to propose and document a maintenance change.
ziro4ka [17]

Answer:

Change request.

Explanation:

Most organizations use a change request form to propose and document a maintenance change. A change request form typically comprises of five (5) basic steps and these are;

1. Change request initiation.

2. Change request analysis.

3. Change request resolution or approval.

4. Change request implementation.

5. Change request verification.

5 0
3 years ago
Other questions:
  • Write a shell script to count down from two hours to zero seconds using the hour, minute, second display format utilizing the sh
    5·1 answer
  • You are an inventor. You are taking out an ad in a newspaper because you want people to buy/use your product/invention. Include
    9·1 answer
  • 4+4 act quick for brainliest
    10·2 answers
  • I need someone to help. This is the links I found and I'm going through the same thing. I live in small town where they think I'
    14·1 answer
  • Consider the following C code fragment:
    10·1 answer
  • E-mail has made it very easy to send a message to more than one person at any time of day from just about anywhere. If you wante
    12·2 answers
  • How can i get google assistant on my lava iris 820 smartphone easily???? ​
    10·1 answer
  • Can you please answer the question in the picture ! :)
    6·1 answer
  • List at least 5 professions for people working in the Information/Communication<br> fields.
    10·1 answer
  • Please Help, Thank you!
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!