answer.
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
sukhopar [10]
2 years ago
10

Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8.

Otherwise, print "userNum2 is less than or equal to 8.. End with newline. 1 public class UserNums 2public static void main (String args) int userNum1; int userNum2 userNumt - -1; userNum2 7; Your solution goes here / 10 System.out.printin("userNum2 is "userNum2);
Computers and Technology
1 answer:
Butoxors [25]2 years ago
8 0

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter User name 1 and 2");

       int userNum1 = in.nextInt();

       int userNum2= in.nextInt();

       if(userNum1<0){

           System.out.println("userNum1 is negative.");

       }

       else if(userNum2>8){

           userNum2 =0;

       }

       else{

           System.out.println("userNum2 is less than or equal to 8..");

       }

   }

}

Explanation:

This is implemented in Java programming language

Using the scanner class, the user is prompted to enter two numbers

These are saved in the variable userNum1 and userNum2 respectively.

If, else if and else statements are then used according to the specifications given in the question.

You might be interested in
You have several pictures of different sizes that you would like to frame.A local picture framing store offers two types of fram
exis [7]

Answer:

written in java

Note :  Package name was excluded

 

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       //declared 8 uninitialised variable  

       String input;

       double cost, colorC, frameC, paperC, glassC, crownC;

       char crowns;

       int type, color, crown, length, width, area, perimeter;

       

       //creating an instance of the Scanner class to accept value from user

       Scanner scanner = new Scanner(System.in);

       System.out.print("Enter length of frame: ");

       length = scanner.nextInt();

       System.out.print("Enter width of frame: ");

       width = scanner.nextInt();

       System.out.print("Do you want a fancy frame or a regular frame\nEnter 1 for fancy, 2 for regular: ");

       type = scanner.nextInt();

       if (type == 1) {

           frameC = 0.25;

       } else {

           frameC = 0.15;

       }

       System.out.print("Do you want a white frame or a colored frame\nEnter 1 for white, 2 for colored: ");

       color = scanner.nextInt();

       if (color == 2) {

           colorC = .10;

       } else{

           colorC = 0;

       }

       System.out.print("Do you want crowns \nEnter y for yes, n for no ");

       input = scanner.next();

       crowns = input.charAt(0);

       if (crowns == 'y' || crowns == 'Y') {

           System.out.print("How many crowns?");

           crown = scanner.nextInt();

       } else

           crown = 0;

       if (crown > 0)

           crownC = crown * .35;

       else

           crownC = 0;

       area = length * width;

       perimeter = length * 2 + width * 2;

       paperC = area * .02;

       glassC = area * .07;

       cost = glassC + paperC + crownC + colorC * perimeter + frameC * perimeter;

       System.out.println("The cost of your frame is: $" + cost);

   }

}

5 0
2 years ago
A mistake programmers often make with loops is that they ____.
Soloha48 [4]

I think the best answer is D. Initialize the loop control variable prior to entering the loop body.

Please correct me if I'm wrong!! I'd be happy to fix it!! :)

4 0
2 years ago
Which of the following is not a characteristic of a good value log entry
Stolb23 [73]
What are we supposed to find? Help us
6 0
1 year ago
Your computer has a quad-core processor that supports multithreading installed. given that the system is running windows, how ca
AlexFokin [52]
By using cpu-z or the performance ran in taskmgr
8 0
2 years ago
When you check to see how much RAM, or temporary storage you have available, you are checking your _____.
victus00 [196]

Answer: primary memory

5 0
2 years ago
Other questions:
  • A _______ is a shortcut to a web page saved in a list in the internet explorer desktop application.
    14·1 answer
  • Graphical elements that precede each item in a list are known as​ __________.
    8·1 answer
  • Many organizations keep copyrighted information on their intranets, which is one reason usernames and passwords are required. Tr
    13·1 answer
  • A patient asks her doctor to send a copy of her records to another medical office. However, the records are not transmitted beca
    10·2 answers
  • In what year were graphical user interfaces (GUIs) pioneered? 1969 1974 1991 2001
    12·2 answers
  • #Remember that Fibonacci's sequence is a sequence of numbers
    14·1 answer
  • Use the following data definitions data myBytes BYTE 10h,20h,30h,40h myWords WORD 3 DUP(?),2000h myString BYTE "ABCDE" What will
    9·1 answer
  • For example, consider a file with protection mode 644 (octal) contained in a directory with protection mode 730. How might the f
    9·1 answer
  • Select the correct answer. Andy wants to become a multimedia producer. Which degree can help him achieve this goal? A. bachelor’
    5·1 answer
  • Why is it important for element IDs to have meaningful names?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!