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
Why is a DNS cache poisoning attack dangerous? Check all that apply. A. Errrr...it's not actually dangerous. B. It allows an att
larisa [96]

Answer:

(B) It allows an attacker to redirect targets to malicious webserver.

(D) It affects any clients querying the poisoned DNS server.

Explanation:

DNS cache poisoning is a serious type of attack that is designed to exploit the vulnerabilities inherent in a Domain Name Server (DNS) where a user is redirected from a real server to a fake one. It is also called DNS spoofing.

Normally, when your browser tries to visits a website through a given domain name, it goes through the DNS server. A DNS server maintains a list of domain names and their equivalent Internet Protocol addresses. This server (DNS) then responds to the request with one or more IP addresses for the browser to reach the website through the domain name.

The computer browser then get to the intended website through the IP address.

Now, if the DNS cache is poisoned, then it has a wrong entry for IP addresses. This might be via hacking or a physical access to the DNS server to modify the stored information on it. Therefore, rather than responding with the real IP address, the DNS replies with a wrong IP address which then redirects the user to an unreal website.

Although they might not be able to control your computer remotely as long as you are not trying to visit a web page via the poisoned information, there are other dangers attached to this type of attack.

Once the DNS server has been poisoned, any client trying to query the server will also be affected since there is no direct way of knowing if the information received from the server is actually correct.

4 0
3 years ago
Please help with attached file
Paul [167]
Where is the attached file?
8 0
3 years ago
Read 2 more answers
Which UML relationships should be used between a subclass and a superclass? For example, suppose there is an interface or abstra
victus00 [196]

Answer:

C. Generalization

Explanation:

The relationship between subclass and superclass is generalization. For example there will be generalization between the class Employee and class HourlyEmployee which inherits from it. All the other options are not suitable.

8 0
3 years ago
"the ____ criteria filter requires the records displayed to have the specified text string anywhere."
Debora [2.8K]

The contains criteria filter requires the records displayed to have the specified text string anywhere. Thecontains operator is used to perform case-sensitive matching regardless of location in strings.

The begins with criteria filter on the other hand requires the records displayed to start with the specified text string

3 0
3 years ago
Which keyboard feature is a form feed character?
Sever21 [200]

Answer:

B

Explanation:

The form feed character code is defined as 12 (0xC inbhexademical), and may be represented as control+L or^L. In a related use, control+L can be used to clear the screen in Unix shells such as bash. In the C programming language ( and other languages derived from C ), the form feed character is represented as '\f'.

5 0
3 years ago
Other questions:
  • What is Least effective at preventing a computer virus
    10·1 answer
  • Which question best addresses the issue of risk with a new job?
    7·2 answers
  • Assume that name and age have been declared suitably for storing names (like "abdullah", "alexandra" and "zoe") and ages respect
    14·1 answer
  • How do you reduce computer screen flicker
    11·1 answer
  • If you define a destructor, are you required to define an operator '=' and a copy constructor?
    9·1 answer
  • A(n) _____ is a request for the database management software to search the database for data that match criteria specified by th
    15·2 answers
  • After adjusting your seat, your _____ should be as close as possible to the backrest
    7·2 answers
  • What is internet marketing??
    13·1 answer
  • Which is true for comments? Group of answer choices The compiler does not generate machine code for comments. The compiler conve
    14·1 answer
  • the first thing to do when your computer gives you an error message is A restart the computer B press the F2 key C write down th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!