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
scoray [572]
3 years ago
12

Declare a character variable letterStart. Write a statement to read a letter from the user into letterStart, followed by stateme

nts that output that letter and the next letter in the alphabet. End with a newline. Hint: A letter is stored as its ASCII number, so adding 1 yields the next letter. Sample output assuming the user enters 'd': de
Computers and Technology
1 answer:
natka813 [3]3 years ago
8 0

Answer:

public class ANot {

   public static void main(String[] args) {

       System.out.println("Enter a char");

       Scanner in = new Scanner(System.in);

       char letterStart = in.next().charAt(0);

       char nextCha = (char)(letterStart+1);

       System.out.print(letterStart);

       System.out.println(nextCha);

   }

}

Explanation:

The main logic here is understanding that characters in Java are stored as ASCII numbers and as such some mathematic operations can be carried out on them. So we add 1 to the value of the entered character to get the character next to it, the opposite is also possible (Subtracting 1 to get the value before it)

Note also that in reading a character using the scanner class Java does not support the nextChar like it does for other primitive data types so we use the method charAt(). To obtain the character at a particular index.

You might be interested in
Which of the following is the result of a query?
IgorLugansk [536]
I think the answer is A
6 0
3 years ago
If you are to save something in your life what would it be<br>2.<br>and why?​
jeyben [28]
I would save memories in my opinion thats the most important thing.
4 0
3 years ago
Dakota's friend Stephen created a cypher using the QWERTY keyboard, but Dakota is confused. Stephen said to move one to the righ
Radda [10]

Answer:

people are so confusing nowadays... Mr. Kopin told me to get him a coffee. I'm not his servant!

Explanation: QWERTY Q=P A=L Z=M and the others are what is to the left of them.

5 0
3 years ago
Every computer consists of physical components and nonphysical components. the nonphysical components of a computer that underst
IrinaVladis [17]
Physical component means Computer Hardware which you can touch and non Physical component means Software, which you can not touch. nonphysical component designed specially for physically component. like Microsoft company designed Software according the Hardware for example Microsoft windows 64 bit could not install on which 32 bit Architecture Hardware.
7 0
3 years ago
In the web form you are creating, you want a multiple-option select list to appear with five options. which line of html code wi
suter [353]
You will use a <select> for this. For example:

<select name="choice">
  <option>First</option>
  <option>Second</option>
  <option>Third</option>
  <option>Fourth</option>
  <option>Fifth</option>
</select>
5 0
3 years ago
Other questions:
  • Ten 9600-bps lines are to be multiplexed using TDM. a. Ignoring overhead bits in the TDM frame, what is the total capacity requi
    6·1 answer
  • 1- Design a brute-force algorithm for solving the problem below (provide pseudocode): You have a large container with storage si
    10·1 answer
  • How did the discovery of glossopteris support wegner's continental drift hypothesis?
    15·1 answer
  • What are the methods of identifying publicly switched networks?
    14·1 answer
  • An example of creative curating is when a:
    9·1 answer
  • A look to different section of the same page is known as_____.
    7·1 answer
  • Two Technicians are discussing ShopKey Pro. Technician
    14·1 answer
  • MULTIPLE COICE! BRAINLIEST
    12·1 answer
  • Luis saves an attachment that he received from Kevin. Where will the attachment save by default?
    5·1 answer
  • What is the difference between compliled and intebrated language?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!