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
Write a statement that declares a prototype for a function powerTo, which has two parameters. The first is a double and the seco
Dimas [21]

Answer:

Following are the statement of the program in the C++ Programming Language.

//prototype of the function

double powerTo (double, int);

Explanation:

In the following statement which is written in the C++ Programming Language.

  • The function prototype tells us what type of data type return by that function.
  • We declare the prototype of the function "powerTo()" which returns the double and pass two arguments first one is double data type and the second one is integer data type.
7 0
3 years ago
Is spread spectrum transmission done for security reasons in commercial WLANs?
bearhunter [10]

Answer: No

Explanation: Spread spectrum transmission is the wireless transmission technique for the wide channel that helps in decrement of the potential interference.The transmission of signal is based on the varying the frequency knowingly to achieve larger bandwidth.

The use of spread spectrum transmission in the WLAN(wireless local area network)is used for the regulatory purpose The regulation is the controlling of the area  through policies.Thus,security is not the service that is provided to WLAN by spread spectrum transmission.

6 0
3 years ago
Choose the answer that best completes the
Fiesta28 [93]

Answer:

the information processing cycle

Explanation:

3 0
2 years ago
Read 2 more answers
Lewis is using a stylus with his touch screen computer in order to draw a
Drupady [299]

Answer:

imput

Explanation:

4 0
2 years ago
What do newly PivotTables look like?
adell [148]

Answer:

Answer is in attached image!

Explanation:

8 0
2 years ago
Other questions:
  • True / False<br> Registers are generally optimized for capacity instead of speed.
    14·1 answer
  • The two variables causing the point of difference between the time codes are the frequency and the count
    6·1 answer
  • Suppose your friend, who is a small business owner, wants to computerize her business functions such as accounting, payroll, and
    7·1 answer
  • In order to use an object in a program, its class must be defined.
    9·1 answer
  • A building is equipped with light sensors that turn off the fluorescent lights when natural light is above a certain brightness.
    5·1 answer
  • In terms of object-oriented programming, after a class is defined,
    11·1 answer
  • Explain the purpose of QoS on a TCP/IP network. Define the basic purpose of IP prece- dence, Type of Service, Diffserv, and Expl
    11·1 answer
  • Describe in detail what each step would look like if you ran into a software error.
    7·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • Extended essay on globalization not less than 200​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!