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
8.
mario62 [17]

Answer:

<em>Lillipop</em>

Explanation:

If you have your hands correctly placed on the keyboard, the only hand needed to type the word, "lillipop", is the left hand!

<em>Hope I was of Assistance</em><u><em> #SpreadTheLove <3</em></u>

5 0
3 years ago
Select the correct answer.
Anastasy [175]

Answer:

B:Flexability

Explanation:

He wants some one flexable so they fit in with the schedule and jobs he has for the employee

5 0
3 years ago
Read 2 more answers
Which two options are negotiated via ncp during the establishment of a ppp connection that will use the ipv4 network layer proto
liberstina [14]
<span>NCP are protocols that are used for establishing PPP sessions. </span>During the establishment of a PPP connection that will use the IPv4 network layer protocol the following options are negotiated: the algorithm to compress TCP and IP headers and the IPv4 address used for routing IP over the PPP link.

6 0
3 years ago
What is the function of the command prompt?
yan [13]
The answer is B cause you use it to make commands
6 0
3 years ago
Word can store a maximum of how many documents in its Recent Documents area? five ten fifteen twenty
djyliett [7]
The answer is twenty.
5 0
3 years ago
Other questions:
  • The number of credits awarded for the CLEP exam is determined by__<br> Help pls!
    15·1 answer
  • When will it be determined whether or not a donor's organs are fit for recovery and transplantation?
    10·2 answers
  • What is a mortgage?
    8·2 answers
  • Explain word processing ​
    11·2 answers
  • How does white balancing affect the images recorded by a camera?
    15·1 answer
  • Why is compression a "hard problem" for computers? Draw on your own experience compressing text with the text compression widget
    12·1 answer
  • The term ____ describes primary storage devices that are implemented as microchips, can read and write with equal speed, and can
    8·1 answer
  • .What particular skills does a team leader need in addition to the other skills needed by any team member. (choose all that appl
    6·1 answer
  • What does the Python print() function do?
    7·1 answer
  • 19 dollar fortnite gift card
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!