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]
2 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]2 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
CODEHS: WHY is it important to know the difference between div and span?
DerKrebs [107]

Span and div are both generic HTML elements that group together related parts of a web page. However, they serve different functions. A div element is used for block-level organization and styling of page elements, whereas a span element is used for inline organization and styling.

3 0
2 years ago
Which of the following would be better communicated with an image than with text?
slega [8]

Answer:

A decor to a wedding

Explanation:

its bc who would want to know how its described when u could look of how it looks u might be speechless

8 0
3 years ago
Write a program num2rome.cpp that converts a positive integer into the Roman number system. The Roman number system has digits I
Tom [10]

Answer:

Explanation:

#include <stdio.h>  

int main(void)  

{    

   int num, rem;

   printf("Enter a number: ");

   scanf("%d", &num);

   printf("Roman numerals: ");        

   while(num != 0)

   {

       if (num >= 1000)       // 1000 - m

       {

          printf("m");

          num -= 1000;

       }

       else if (num >= 900)   // 900 -  cm

       {

          printf("cm");

          num -= 900;

       }        

       else if (num >= 500)   // 500 - d

       {            

          printf("d");

          num -= 500;

       }

       else if (num >= 400)   // 400 -  cd

       {

          printf("cd");

          num -= 400;

       }

       else if (num >= 100)   // 100 - c

       {

          printf("c");

          num -= 100;                        

       }

       else if (num >= 90)    // 90 - xc

       {

          printf("xc");

          num -= 90;                                              

       }

       else if (num >= 50)    // 50 - l

       {

          printf("l");

          num -= 50;                                                                      

       }

       else if (num >= 40)    // 40 - xl

       {

          printf("xl");            

          num -= 40;

       }

       else if (num >= 10)    // 10 - x

       {

          printf("x");

          num -= 10;            

       }

       else if (num >= 9)     // 9 - ix

       {

          printf("ix");

          num -= 9;                          

       }

       else if (num >= 5)     // 5 - v

       {

          printf("v");

          num -= 5;                                      

       }

       else if (num >= 4)     // 4 - iv

       {

          printf("iv");

          num -= 4;                                                            

       }

       else if (num >= 1)     // 1 - i

       {

          printf("i");

          num -= 1;                                                                                    

       }

   }

   return 0;

}

8 0
2 years ago
In cell I8, enter a nested logical function to display Need to Remodel if the apartment is unoccupied (No) AND was last remodele
galina1969 [7]

Answer:

The Function is given as

=IF(AND(E8="No",G8>10),"Need to remodel","No Change")

Explanation:

The syntax of the IF condition in excel is given as

IF(Test,If true,If false)

So here the test is an and component such that the house has to be unoccupied which is indicated as E8 because the E column contain the occupancy of the apartments, and the G8 is the last remodeling time, so the test statement is the AND operation of the conditions as

E8="No" indicating that house is unoccupied

G8>10 indicating that the last remodelling was more that 10 years ago

So the test is given as

AND(E8="No",G8>10)

Now the statement if the test true is the recommendation for to remodel, so

"Need to remodel"

Now the statement if the test is false is given as

"No Change"

So the overall function becomes

=IF(AND(E8="No",G8>10),"Need to remodel","No Change")

3 0
2 years ago
A Computer Programmer who wants to be surrounded by a large number of like-minded coworkers should take a job with one of the na
vichka [17]

Answer:

C

Explanation:

This job will have the largest amount of 1. computer programmers, 2. like-minded coworkers, and 3. a large number of like-minded coworkers.

Please give Brainliest if accurate!

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the purpose of this diamond shape in a flowchart?
    8·1 answer
  • What daily life problems does the algorithm quicksort solve?
    14·1 answer
  • Which of the following statements best compares and contrasts the role of story writers and script writers
    12·1 answer
  • Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN
    7·2 answers
  • Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each t
    9·1 answer
  • What is the term for the conversion of a bitmap image to a vector image?
    8·1 answer
  • Which statement most aptly defines the term networking?
    8·1 answer
  • An organization is trying to decide which type of access control is most appropriate for the network. The current access control
    12·1 answer
  • Can someone please explain to me how the points work when you ask a question? Worth 30 points I think, I still don't know how th
    5·2 answers
  • How to edit slides into video.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!