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
Troyanec [42]
3 years ago
8

Copy the skeleton of code below into your answer. Then in the space indicated, add your own code to prompt the user for two numb

ers and a string and then prints the difference of those numbers with a message to the user (text in bold is input entered by the user). Note that the final output should be on a line by itself. Recall that the difference of two numbers is found by subtracting the second number from the first.
Enter the first: 10
Enter the second: 3
Enter your name: Dinah Drake
Dinah Drake, the difference is 7
Computers and Technology
1 answer:
ahrayia [7]3 years ago
7 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter the first: ");

 int first = input.nextInt();

 System.out.print("Enter the second: ");

 int second = input.nextInt();

 input.nextLine();

 System.out.print("Enter your name: ");

 String name = input.nextLine();

 

 int difference = Math.abs(second - first);

 

 System.out.println(name + ", the difference is " + difference);

}

}

Explanation:

*The code is in Java.

Create a Scanner object to get input from the user

Ask the user to enter the first, second, and name

Calculate the difference, subtract the second from the first and then get the absolute value of the result by using Math.abs() method

Print the name and the difference as in required format

You might be interested in
Please dont delete. my teacher said to see how many people I could meet on here. THIS IS A BIG PART OF MY GRADE!! DO NOT REPORT!
Setler [38]
Well here’s one, hello.
7 0
3 years ago
Read 2 more answers
Where can you make changes to AutoCorrect?
spayn [35]
The answer is; The file tab
6 0
4 years ago
Read 2 more answers
Select the correct answer. Which sentence best describe an effective management strategy? A. Conceal game-related clippings prio
andrew-mc [135]

Answer: I would say it is B

5 0
4 years ago
Read 2 more answers
Which operating system became obsolete with the arrival of more advance graphical user interfaces
jarptica [38.1K]
MS-DOS. MS-DOS stands for Microsoft Disk Operating System. It was the first widely installed operating system for personal computers but became obsolete with the arrival of more advanced graphical user interfaces such as MAC OS developed by Apple, Inc.

Good Luck!
8 0
3 years ago
For security reasons a network administrator needs to ensure that local computers cannot ping each other. which settings can acc
liq [111]
<span>The administrator of the network can access the admin settings on the network's primary DNS servers. From there, there are hundreds of various settings and changes to make. There is one, however, that is able to disable pings. This will prevent computers from responding to ping requests. This can help to ensure internal security and reduce internal network traffic.</span>
6 0
3 years ago
Other questions:
  • Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he
    12·1 answer
  • How do you solve this.
    12·1 answer
  • Can anyone guide me on what to learn after C language?
    15·1 answer
  • . What are the disadvantages of using small, fixed-length cells in ATM?
    13·2 answers
  • Which kind of software allows users to draw pictures, shapes, and other graphical images with various on-screen tools such as a
    14·1 answer
  • Write a C function (NOT A COMPLETE PROGRAM)which takes three parameters which are the cost for an item in a grocery store, the q
    12·1 answer
  • "_____ devices improve memory by encoding items in a special way."
    13·1 answer
  • What is good prossesser
    15·2 answers
  • Firewall ____ indicate whether a large number of echo messages are being received.
    9·1 answer
  • Hello. I really need this done ASAP. Don't scroll down. JUst look please.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!