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
spin [16.1K]
3 years ago
5

Create a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop shou

ld ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate
Sample Run1

Enter two numbers: 3 15

Do you want another operation: Yes

Enter two numbers: 45 56

Do you want another operation: No

Output1: Sum = 119

Sample Run2

Enter two numbers: 33 150

Do you want another operation: Yes

Enter two numbers: -56 56

Do you want another operation: Yes

Enter two numbers: 58 15

Do you want another operation: Yes

Enter two numbers: 123 87

Do you want another operation: No

Output2: Sum = 466
Computers and Technology
1 answer:
Gala2k [10]3 years ago
6 0

Answer:

import java.util.Scanner;

public class TestClock {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int sum = 0;

       char op;

       do{

           System.out.println("Enter two numbers");

           int num1= in.nextInt();

           int num2 = in.nextInt();

           sum = sum+num1+num2;

           System.out.println("Do you wish to perform another operation, Y/N");

           op =in.next().charAt(0);

       }while(op =='Y'||op=='y');

       System.out.println("sum "+sum);

   }

}

Explanation:

The code is implemented in Java progrmming language

  1. create an integer variable sum
  2. create a character variable op
  3. create a do while loop to request user to enter num1 and num2
  4. Request the user to also enter a char Y/N (yes or no repectively)
  5. While the char is Y keep adding up the sum and prompt the user to enter two new numbers
  6. Else break out of the loop and print the sum
You might be interested in
Lance is at a bus station. his friend is using the atm machine to withdraw some money. lance notices a stranger deceptively watc
stich3 [128]

The person watching Lances friend typing the ATM pin is an example of shoulder browsing. Lances friend should change the ATM pin.

<h3>What does ATM mean?</h3>

This is known as automated teller machine. It is said to be a kind of unique computer that makes it easy to manage a bank account holder's money.

Based on the above, The person watching Lances friend typing the ATM pin is an example of shoulder browsing. Lances friend should change the ATM pin so that his funds will not be stolen.

Learn more about ATM from

brainly.com/question/12629434

#SPJ4

4 0
2 years ago
Read 2 more answers
Two of the people most often credited with the invention of the Internet and WWW respectively are _____.
krek1111 [17]
Bob Kahn and Vint Cerf were both pioneers of the Internet, and Tim Berners-Lee was known for inventing the WWW.
7 0
3 years ago
NAT ________. allows a firm to have more internal IP addresses provides some security both allows a firm to have more internal I
algol13

Answer:

NAT provides some security but allows a firm to have more internal IP addresses

Explanation:

NAT ( network address translation) this is a process where a  network system usually a firewall  assigns a public IP address to an internal computer used in a private network. it limits the number of public IP address a company operating a private network for its computer can have and this is very economical also limits the exposure of the company's private network of computers. the computers can access information within the private network using multiple IP addresses but it is safer to access external information using one public IP address

5 0
2 years ago
A website whose URL ends with .gov, .edu, or .org is necessarily a reliable source. True or False
natali 33 [55]
True because they are educational anything .com and sometimes .net because .gov is from the government so it is very safe to use and .edu is for education it is always used to help people with education etc and .org is   public which other people can say false and save you from false information
7 0
2 years ago
How many numbers can be represented with 2,3,4,8 bits?
MrRa [10]
Image that a bit is the smallest measure in programming, such as an elementary particle in physics. So, a bit can only fit one number.
5 0
3 years ago
Other questions:
  • Explique si en la pc que se usa para hacer las tareas escolares se puede ver un video juego de los llamados “pesados”
    13·1 answer
  • What is one of the benefits of using templates for your email marketing campaigns?
    10·1 answer
  • When you're working on an image, it's a good idea to make a ____________ of the image, so that you'll have the original image in
    12·2 answers
  • NAND is logically complete. Use only NAND gates to constructgate-level circuits that compute the
    7·1 answer
  • Patronage of most Medieval musicians was supplied by the
    13·1 answer
  • Write a SELECT statement that returns a single value that represents the sum of the largest unpaid invoices submitted by each ve
    5·1 answer
  • What does this function do in the code?
    5·2 answers
  • Using C++
    13·1 answer
  • Explain why you do not need expensive equipment to take pictures or record video?
    7·2 answers
  • Identify the network and the host address in the ip address of 12.128.120.131 with a subnet mask of 255.128.0.0.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!