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
sashaice [31]
3 years ago
11

Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompt the us

er 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:
Dominik [7]3 years ago
4 0

Answer:

import java.util.*;

public class Main {

public static void main(String[] args)

{

Scanner scan = new Scanner();

double budget=0, num=0, total=0;

System.out.println("Your budget for the month? ");

budget=scan.nextDouble();

System.out.println("enter all expense, and after that type -9999 to quit: ");

while(num != -9999)

{

total+=num;

num=scan.nextDouble();

}

if(total<=budget)

{

System.out.println("under budget by ");

System.out.println(budget-total);

}

else

{

System.out.println("over budget by ");

System.out.println(total-budget);

}

}

}

Explanation:

  • Take the budget as an input from user and store it to the budget variable.
  • Loop until user has entered all his expenses and keep on adding them to the total variable.
  • Check If the total is less than or equal to budget or otherwise, and then print the relevant message accordingly.
You might be interested in
I need to know thr full number of pie
valina [46]

Answer:

3.14159

Explanation:

5 0
3 years ago
I really need help please abari is writing a program which prompts a user for a value without a decimal. Which function should h
insens350 [35]

Answer:

print()

Explanation:

print allows you to add words into the script, like this;

script.parent.mouse.touch <u>then</u>

<u>print(¨ḧimenewew¨)</u>

4 0
3 years ago
One of the most toxic components of a computer is the
Cloud [144]
The most common is usually lead found in the glass or some circuits in rare cases
6 0
3 years ago
Does technology get in the way of learning ?<br> Help Meh ! ♥ Some ideas :D
Nady [450]
Yes, and no, social network can distract a student like YouTube or face book, while it can be used as a tool for studying and to put your google documents in the cloud. plus if a teacher posts homework on his/her website, and you happen to forget the paper bringing it home, you can just simply print it instead of having to explain to the teacher
6 0
3 years ago
Read 2 more answers
How do users log into Windows 8?
bogdanovich [222]
I think it’s swipe up if i’m correct, if not sorry
5 0
3 years ago
Other questions:
  • Write a function, factors, that takes an integer n, and returns a list of values that are the positive divisors of n. Note: 0 is
    13·1 answer
  • These items describe guidelines for the effective use of presentation graphics. Graphics should be large enough to be seen by th
    9·1 answer
  • What do you think is the most fascinating aspect of the Internet
    5·2 answers
  • How does an individual's access to a wide range of online services affects their ability to operate safely in the digital world.
    5·1 answer
  • Which of the following keywords is used to remove a row in a table? (Points : 2) DROP
    11·1 answer
  • Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors p
    5·1 answer
  • Add the following method to the Point class: public double distance(Point other) Returns the distance between the current Point
    12·1 answer
  • 8.11 LAB: Filter and sort a list
    8·1 answer
  • What is the name of the process of checking the client's production environment to ensure software and hardware compatibility wi
    5·2 answers
  • it is good to know and use the npsd framework while solution envisioning as part of the value discovery cycle. What is NPSD?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!