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]
3 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]3 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
Write a program that will input a list of test scores in from the keyboard. When the user enters -1, print the average.
aivan3 [116]

Answer: -1 usually represents infinity.

Explanation:

It would keep going forever and not be able to stop without manually stopping it.

3 0
3 years ago
Read 2 more answers
You company hired you to build a network. List of technical question that you will ask?
vredina [299]

Explanation:

1. How many computers do you want to connect or how big the network should be?

This would tell us what kind of a network need to be built. It can be LAN/MAN/WAN

2. The location where network needs to be built?

We have to check the geographic condition too before creating a network

3. What is the budget?

Based on the budget only, we can decide the wires to be used if require we can negotiate the budget so that we can create effective network

4. Will I get an additional resources to work?

This is essential to estimate the time that is required to complete the task.

5. When the project needs to be completed?

This is crucial because a business might be planned thereafter.

6 0
3 years ago
A PC is not able to connect to a wired network. Pinging the loopback address is successful, but the gateway cannot be reached. O
tangare [24]
Usually that means a physical connection - so either a loose or faulty ethernet cord.
5 0
3 years ago
Which of the following controls computer memory?
Bogdan [553]
Operation system (OS)
4 0
3 years ago
Will there be another season in Star vs the forces of evil?
valentina_108 [34]
The world may never kno
3 0
3 years ago
Other questions:
  • The term ________________ denotes data that is being stored on devices like a universal serial bus (USB) thumb drive, laptop, se
    9·2 answers
  • What variation of a dictionary attack involves a dictionary attack combined with a brute force attack, and will slightly alter d
    9·1 answer
  • Which would take more storage space, a layer file showing all the us counties or a layer file showing all the us states?
    8·1 answer
  • The measure of the maximum amount of data that can travel through a computer’s communications path in a given amount of time is
    9·1 answer
  • Weakness in software can be more quickly uncovered and exploited with new software tools and techniques.
    6·1 answer
  • Which of the following people was a member of FFA?
    7·1 answer
  • What is the HIPAA Privacy rule, and why does it affect IT professionals?
    5·1 answer
  • Mobile apps are replacing the old__________<br><br>​
    7·2 answers
  • How do I delete my account on Brainly? It says I must enter my password to do so, but I never set up a password. When I try the
    8·1 answer
  • What are 3 of the most important things about internet safety that you would recommend and why
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!