write a program called a1q1 that reads a single


Write a program called, A1Q1, that reads a single letter.   It will then display the corresponding ASCII code of the letter and prints the next character and the character which is corresponding to the "ASCII code + 3".  Comment on the unusual behaviour if you enter 'z' or 'Z' or '9' or '@'.  Shorthand operators and increment/decrement operators should be used in your code.

2. Write a program called A1Q2, that calculates the energy needed to heat water from an initial temperature to a final temperature. Your program should prompt the user to enter the volume of water in gallons and the initial and final temperatures in Fahrenheit. The formula to compute the energy isenergy = mass * (temperatureFinal - temperatureInitial ) * 4184 where 'mass' is in Kg; temperatures are in degrees Celsius and  'energy' is in J.  You will need to convert the inputs to the proper units (1 gallon = 3.785 litres).  Use constants not numeric literals to define physical constants and conversion factors.  What happens if the user enters the values as octal or hexadecimal numbers?

Here is a sample run:

Enter the amount of water in gallons: 11.5 

Enter the initial temperature in F: 55.2 

Enter the final temperature in F: 78.5 

To heat the water of 43.5275 kg from 12.8889 C to 25.8333 C, the required energy is 2357.43 KJ.

Request for Solution File

Ask an Expert for Answer!!
Civil Engineering: write a program called a1q1 that reads a single
Reference No:- TGS0209380

Expected delivery within 24 Hours