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
The software used to help run the computer hardware is the _____.
TiliK225 [7]
C. system software
if it means drivers and so on
6 0
3 years ago
Read 2 more answers
Porque sophia es un robot mujer?
gregori [183]
Sophia es un robot humanoide (ginoide) desarrollado por la compañía, con sede en Hong Kong, Hanson Robotics. Ha sido diseñada para aprender, adaptarse al comportamiento humano y trabajar con estos satisfactoriamente.
7 0
2 years ago
Data stored in computer systems has a high value because there is a great deal of time and effort that goes into creating an ana
Andrew [12]

Answer:

Data often has intrinsic value.

Explanation:

Data stored in computer systems has a high value because there is a great deal of time and effort that goes into creating an analyzing it and data often has intrinsic value.

5 0
3 years ago
Types of antivirus explain them
Veronika [31]

Answer: an antivirus is a type of program designed  to protect computers from  viruses, spyware, botnets, rootkits, keyloggers and such. There are many versions and types of anti-virus programs which can be very helpful.

Such as:

Norton.

Kaspersky.

Ad Aware.

AVG

Mc Afee

Hope this helps u...

Explanation:

3 0
3 years ago
Which of the following statements is true of computer networks?
LenaWriter [7]

Answer: (A) Computer networks allow individuals to share many types of resources.  

Explanation:

 Computer network is basically known as digital telecommunication that allowing various nodes to sharing different types of resources in the network. In the computer network, the data link is establish over the cable like wire and optic media in the network.

The network basically allow sharing of the computing network and various types of resources in the networking.

It can allow sharing resources like printers, exchange files and CDs. There are mainly two types of networking that are: LAN and WAN.

5 0
3 years ago
Other questions:
  • When might it be necessary or advisable to write a shell script instead of a shell function? give as many reasons as you can thi
    15·1 answer
  • .Although SQL is a language, you don’t use it to write applications? (true, false)
    8·1 answer
  • What are the coordinates of (3 comma space 8 )relative to the basis open curly brackets space (1 comma space 1 )comma space (0 c
    15·1 answer
  • (3 points) Write a program to process two large chunks of data (e.g., a large 3D array and an array of self-defined structures w
    11·2 answers
  • This refers to the people involved in the data processing operation.
    14·1 answer
  • What is the forging of the return address on an email so that the email message appears to come from someone other than the actu
    11·1 answer
  • IN C++
    13·1 answer
  • Write the function powersOf3ToN(n) that takes a possibly-negative float or int n, and returns a list of the positive powers of 3
    10·1 answer
  • On start up, which of these windows is not displayed ?
    15·2 answers
  • Consider the following code segment.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!