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
ladessa [460]
3 years ago
15

Instructions Write a program that asks the user for a number. If the number is between 1 and 255, the program outputs the corres

ponding ASCII character. If it is outside of that range, the program outputs Out of range.
Computers and Technology
1 answer:
Alenkasestr [34]3 years ago
8 0

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a number between 1 -255");

       int num = in.nextInt();

       if(num >= 1 && num<=255){

           char c = (char)num;

           System.out.println("The ASCII Value of "+num+" is "+c);

       }

       else{

           System.out.println("Out of range");

       }

   }

}

Explanation:

  • Use the scanner class to receive a number from the user save in a variable num
  • Use if statement to ensure the number is within the valid range num >= 1 && num<=255
  • Convert the number to the ASCII equivalent by casting it to char data type
  • Output the number and the ASCII equivalent
  • if num was out of range, print Out of range

You might be interested in
I'm using my PS4 dual shock controller to connect to the fire stick on the tv so I can play games with it but whenever I try to
Mazyrski [523]
Well i'm not gonna suggest you unpiecing your device because you sir probably lack the skills of doing so but what i will suggest to you is to press your share button and you p playstation button at the same time for at least a minute than try charging it again if that solution does work i would advise tring to unopiece the device but by doing carefully and slowly and remembering where each pieces are staying and i want you to take out the eos system and putting it back in and then piece back together and if that solutiuon doesn't work call playstation or email them or go ahead and go and try to repair it or you can  go and BUY A NEW CONTROLLER. hope i helped have a good day bro.
4 0
3 years ago
. _______ view focuses on the text and content of a document, without much information on the page layout.
Georgia [21]
Read view
It allows to hide all instrument panels
5 0
3 years ago
Is a storyboard an example of an implemation tool?
goblinko [34]
Yes, the answer is true.
8 0
3 years ago
Read 2 more answers
What statement should you use to print the value of total with a precision of 5 digits?
Norma-Jean [14]

Answer:

Option A: print("The total is %0.5f" % total)

Explanation:

To ensure the value is rounded to a precision of 5 digits, we have to create a formatted string which is %0.5f. The <em>.5</em> denotes five decimal places and <em>f </em>refers to float data type.

Next, we use the <em>%</em> operator again and followed with the variable <em>total</em>. The % is used as a string modulo operator that will interpolate the value held by the the variable <em>total </em>in the formatted string that we create previously. The interpolated value will be rounded to 5 decimal places. For example, if

total = 256.786789

The output will be 256.78679

5 0
3 years ago
Which of the following steps should you take after attending a college fair?
leonid [27]

D. Make a decision about which colleges to attend that night.

5 0
3 years ago
Read 2 more answers
Other questions:
  • The 3rd generation programming language that most students learned when most computers used MS DOS was ___ . It remains a safe p
    12·1 answer
  • Which of the following is not a general strategy for organizing and analyzing qualitative data?a.Convert the data into one or mo
    6·1 answer
  • Write the method public static doublell quizAverages (double (1 scores). which takes a 2D array of doubles that represent quiz s
    11·1 answer
  • A virtual private network (VPN) is used to securely connect to another network over a insecure network.
    9·2 answers
  • Which of the examples is part of client-side code?
    12·1 answer
  • Plz help Complete the sentence.
    11·2 answers
  • Your company is building a new architecture to support its data-centric business focus. You are responsible for setting up the n
    15·1 answer
  • Resource _____ let you view, manage, and automate tasks on multiple aws resources at a time.
    9·1 answer
  • 1.1 give five (5) reasons why modeling is an important part of system analysis and design
    9·1 answer
  • Python Programming
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!