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
How would you classify the earliest historical examples of STEM discoveries provided in this lesson?
Readme [11.4K]
MATHEMATICAL DISCOVERIES
4 0
4 years ago
Read 2 more answers
When we insert a new node into a red-black tree, we set the color of the newly inserted node n to red. observe that if we had ch
Vika [28.1K]
Cause u didnt want to
4 0
4 years ago
Port explorers ​are tools used by both attackers and defenders to identify (or fingerprint) the computers that are active on a
Evgesh-ka [11]

Answer:

b) False.

Explanation:

Port explorers ​are tools used by both attackers and defenders to identify (or fingerprint) the computers that are active on a network, as well as the ports and services active on those computers, the functions and roles the machines are fulfilling, anAn IDPS can be configured to dial a phone number and produce an alphanumeric page or other type of signal or message., is a FALSE statement.

5 0
3 years ago
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
SVEN [57.7K]
Click Insert
click Picture
click From File
select the desired picture and again click insert
right-click the picture
click Insert Caption
write the caption and add it
5 0
3 years ago
Read 2 more answers
Critical observation thinking is best demonstrated by which of the following actions?
yarga [219]

Answer:

Spotting trend in data(apex)

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the larges
    6·1 answer
  • What is the Best decent priced Laptop/PC
    11·1 answer
  • The (X , y) coordinates of a certain object as a function of time' are given by Write a program to determine the time at which t
    6·1 answer
  • A ________ is a single media file including art, sound, animation, or movies.
    9·1 answer
  • Which of the following is a common sense safety procedure that can help prevent electrical accidents?
    15·1 answer
  • Which of the following correctly declares and initializes a Scanner object that will use input from the keyboard as its data sou
    13·2 answers
  • Match the data types to the types of value they are: Currency, Text, Date/time, and Name.
    11·1 answer
  • Why is dark supereffective against ghost? (AGAIN)
    8·1 answer
  • Which technological tool is important for storing critical files?.
    12·1 answer
  • Which programming paradigm focuses on abstraction to the level of math and the elimination of side-effects and state based progr
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!