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
chubhunter [2.5K]
3 years ago
7

Write a program in Java to input a letter. If it is an uppercase letter then

Computers and Technology
1 answer:
Vadim26 [7]3 years ago
7 0

Answer:

The program is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 char chr;

 System.out.print("Input Character: ");

 chr = input.next().charAt(0);

 if(Character.isUpperCase(chr) == true){      chr+=5;  }

 else{      chr-=3;  }

 System.out.println("Encode Character: "+chr);

}

}

Explanation:

This declares the character

 char chr;

This prompts for input

 System.out.print("Input Character: ");

This gets the input from the user

 chr = input.next().charAt(0);

This checks for uppercase; if true, it is encoded by the next 5th

<em>  if(Character.isUpperCase(chr) == true){      chr+=5;  }</em>

If lowercase, it is encoded by the previous 3rd

 else{      chr-=3;  }

This prints the encoded character

 System.out.println("Encode Character: "+chr);

You might be interested in
PLEASE HELP ASAP!!!!111 Read "Teenagers are rewriting the rules of the news" (find it somewhere and answer questions below)
Ilya [14]

Answer:

Sorry, we picked up your question late. There are a lot of questions, and every now and then some misses out. And I am sure you will understand. However, the cool thing is your answers are correct. I read the complete article on young adults or teenagers and found the same. And I am sure you will agree with the facts, and use its best meaning in your own life. I am, however, listing below all the answers for your complete satisfaction. And I congratulate you, you are up with the correct list of answers.

The answer to the First question is:

B. the description of how influencers follow young social media users"

Second question answer is

C. Andrew Yang

And the third question answer is:

C. Teens and young adults consume and spread news information through social media.

And I am sure you must have liked this article. Article reading is a good habit. You should always start a day by reading one article online or in newspaper.

Explanation:

Please check the answer section.+

4 0
3 years ago
Web browsers are used to browse the world wide web.
VikaD [51]
No its actually used for looking up concerns, questions, or rumours
3 0
4 years ago
Read 2 more answers
When designing a laptop, which three things should designers think about?
FromTheMoon [43]

Answer:B,C,D

Explanation:

7 0
3 years ago
The Gas-N-Clean Service Station sells gasoline and has a car wash. Fees for the car wash are $1.25 with a gasoline purchase of $
Xelga [282]

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

              //print the header

              System.out.println("**************************************");

              System.out.println("*                                    *");

              System.out.println("*                                    *");

              System.out.println("*   Gas-N-Clean Service Station      *");

              System.out.println("*                                    *");

              System.out.println("*   March 2, 2004                    *");

              System.out.println("*                                    *");

              System.out.println("**************************************");

 

               //set the constant values for gasoline

               final double REGULAR_GASOLINE = 2.89;

               final double PLUS_GASOLINE = 3.09;

               final double SUPER_GASOLINE = 3.39;

 

              // initialize the variables as 0

              double gasolinePrice = 0, gasolineCost = 0, carWashCost = 0, totalCost = 0;

 

               Scanner input = new Scanner(System.in);

 

               //ask the user to enter the gallons, gas type and car wash choice

               System.out.print("Enter number of gallons ");

               double gasolinePurchase = input.nextDouble();

               System.out.print("Enter gas type (R, P, S, or N) ");

               char gasType = input.next().charAt(0);

               System.out.print("Enter Y or N for car wash ");

               char carWashChoice = input.next().charAt(0);

               //check the gas type. Depending on the choice set the gasolinePrice from the corresponding constant value

              if(gasType == 'R')

                  gasolinePrice = REGULAR_GASOLINE;

              else if(gasType == 'P')

                  gasolinePrice = PLUS_GASOLINE;

              else if(gasType == 'S')

                  gasolinePrice = SUPER_GASOLINE;

 

                //calculate the gasolineCost

                gasolineCost = gasolinePurchase * gasolinePrice;

 

               //check the carWashChoice. If it is yes and gasolineCost is greater than 10, set the carWashCost as 1.25. Otherwise, set the carWashCost as 3.00

               if(carWashChoice == 'Y'){    

                   if(gasolineCost >= 10)

                       carWashCost = 1.25;

                   else

                       carWashCost = 3.00;

               }

              //calculate the total cost, add gasolineCost and carWashCost

              totalCost = gasolineCost + carWashCost;

 

               //print the values in required format

              System.out.println("Amount Gasoline purchases " + gasolinePurchase);

              System.out.println("Gallons Price per gallons $ " + gasolinePrice);

              System.out.printf("Total gasoline cost $ %.2f\n", gasolineCost);

              System.out.println("Car wash cost $ " + carWashCost);

              System.out.printf("Total due $ %.2f\n", totalCost);

               System.out.println("Thank you for stopping\nPlease come again \nRemember to buckle up and drive safely");

}  

}

Explanation:

*The code is in Java.

Please see the comments in the code for explanation

4 0
3 years ago
A notebook computer is set up to take maximum advantage of power saving features including shutting down the display and the har
astra-53 [7]

Answer:

The reason is that the windowing system consumes significantly more memory and virtual memory than the text mode.

Explanation:

The reason behind the occurrence of this is that the windowing system consumes significantly more memory and virtual memory than the text mode. As a result, this reduces the likelihood of the hard disk becoming inactive for long enough for it to be powered down by itself with no direct human control, i.e. automatically.

6 0
3 years ago
Other questions:
  • ASAP
    12·2 answers
  • What technological changes at the turn of the twentieth century affected american life?
    6·1 answer
  • If a business filing bankruptcy has assets in the United States and one or more foreign countries, that business should file und
    6·2 answers
  • What are the two main parts of system unit hardware?
    8·1 answer
  • Write a half page summary on how to clean a Gaming PC properly.
    14·1 answer
  • 4. Why does Hancock believe that our communication online is more honest than we might<br> expect?
    15·2 answers
  • Danny wants to create a web page for her friends dog walking service. Which coding language should she use
    12·1 answer
  • Which of the following is an operating system?<br> MacBook Air<br> Windows 10<br> Dell
    13·2 answers
  • Why does my wifi keep disconnecting and reconnecting?
    9·1 answer
  • 22. Write the following in full un computer
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!