Question

In: Computer Science

Write in java Q 4.Centigrade and Fahrenheit are two scales to measure temperature. Write a program...

Write in java

Q 4.Centigrade and Fahrenheit are two scales to measure temperature. Write a program that that prompts the user to enter Centigrate and then print the Fahrenheit.

Use following formula for conversion.

Fahrenheit = Centigrade*1.8 +   32 ;

Q. 7 Write a program to calculate the bill of a customer. The program will

-           Prompt the employee to enter the monthly plan fees.

-           Prompt the employee to enter the rate per additional minute.

-          Print the bill

The bill will be calculated as follows: if the number of consumed minutes is 300 minutes or less, the client pays only his regular monthly fees. If the number of minutes is more than 300, then he should pay in addition to the regular monthly fees, an extra amount for each additional minute consumed (over the allowed 300 minutes using rate per additional minute.).

Solutions

Expert Solution

Q4.

import java.util.Scanner;
public class Main
{
   public static void main(String[] args) {
       System.out.println("Enter Temperature in Centigrade"); //promt user to write temp in centigrade
       double Centigrade;
       double Fahrenheit;
       Scanner s= new Scanner(System.in);
   Centigrade = s.nextDouble();
   Fahrenheit = Centigrade*1.8 + 32 ;
   System.out.println("Temperature in Fahrenheit"+Fahrenheit); //print temperature in fahrenheit
   }
}

Q7.import java.util.Scanner;
public class Main
{
   public static void main(String[] args) {
   Scanner s= new Scanner(System.in);
       System.out.println("Enter Monthly plan fees"); //Promt employee to enter monthly plan
       int mf=s.nextInt();
       System.out.println("Rate per additional minute"); //Prompt employee to write rate per extra min
       int rpam=s.nextInt();
       System.out.println("No of Minutes Consumed"); //Promt employee to write consumed time
       int nmc=s.nextInt();
       int money;
       if(nmc>300)
       { int a=nmc-300;
       money=mf+ a*rpam;
       System.out.println("Please pay Rs. "+money); //Print the bill
       }
       else
       { money=mf;
       System.out.println("Please pay Rs. "+money); //Print the bill
       }
  
  
  
   }
}


Related Solutions

Develop a form to display centigrade temperature and corresponding Fahrenheit temperature ranging from 30 to 90...
Develop a form to display centigrade temperature and corresponding Fahrenheit temperature ranging from 30 to 90 at increments of 10. Use a do while loop. Please use the below formula to convert Celsius to Fahrenheit in advance C# I need the form not a table. Thank you!
Temperature Conversion Menu (100 pts) The three common temperature scales are Celsius, Fahrenheit and Kelvin. The...
Temperature Conversion Menu (100 pts) The three common temperature scales are Celsius, Fahrenheit and Kelvin. The conversion formulae for each of the scales is shown below (where °C, °F and K represent the temperatures in degrees Celsius, degrees Fahrenheit and Kelvin respectively): Celsius to Fahrenheit: °F = (9.0/5) ´ (°C) + 32 Celsius to Kelvin: K = °C + 273.15 Kelvin to Celsius: °C = K – 273.15 Kelvin to Fahrenheit: °F = (9.0/5) ´ (K – 273.15) + 32...
Write a JAVA program that displays a table of the Celsius temperatures and their Fahrenheit equivalents....
Write a JAVA program that displays a table of the Celsius temperatures and their Fahrenheit equivalents.  The formula for converting a temperature from Celsius to Fahrenheit is F = 9/ 5 C + 32 where F → Fahrenheit temperature C → Celsius temperature.  Allow the user to enter the range of temperatures in Celsius to be converted into Fahrenheit.  Your program must use a loop to display the values of the temperature conversions (see sample output). Sample...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The table should include rows for all temperatures between 0 and 100 degrees Celsius that are multiples of 10 degrees Celsius. Include appropriate headings on your columns. The formula for converting between degrees Celsius and degrees Fahrenheit can be found on the internet. Python 3
Instructions Write a program in C# that converts a temperature given in Fahrenheit to Celsius. Allow...
Instructions Write a program in C# that converts a temperature given in Fahrenheit to Celsius. Allow the user to enter values for the original Fahrenheit value. Display the original temperature and the formatted converted value. Use appropriate value returning methods for entering (input), calculating, and outputting results.
Q : It is desired to maintain the temperature of hospital room at 24 degree centigrade...
Q : It is desired to maintain the temperature of hospital room at 24 degree centigrade at all the time . The size of the room is 12x12 having 2 ton Air conditioner and 1200 watt heater. A) discuss proper mechanism so that the temperature should not exceed 24 degree centigrade at any condition ( Hot or cold weather ). B) suggest and draw a block diagram for temperature control system for hospital room
In Java: Write a program called F2C that allows the user to convert from degrees Fahrenheit...
In Java: Write a program called F2C that allows the user to convert from degrees Fahrenheit to degrees Celsius. The program should prompt for a temperature in Fahrenheit and output a temperature in Celsius. All calculations should be done in in ints, so be careful of truncation.
Write a java program to convert Celsius degrees to Fahrenheit degrees the user enters degrees in...
Write a java program to convert Celsius degrees to Fahrenheit degrees the user enters degrees in Celsius and the program Coverts the input to Fahrenheit using the following formula T(°F) = T(°C) × 1.8 + 32 submit the source code Design output Load: 1. Design (Pseudocode ) 2. Source file (Java file, make sure to include comments) 3. Output file (word or pdf or jpig file)
Write a program read in data from the standard input stream (cin) representing temperature in Fahrenheit....
Write a program read in data from the standard input stream (cin) representing temperature in Fahrenheit. The program will then convert the values into Kelvin (using 5/9 (Fº-32) to convert to Celsius and a difference of 273.15 between Celsius and Kelvin) and print out the new total value. Convert temperature in Fahrenheit to Kelvin : Enter temperature in Fahrenheit: 80.33 The temperature in Kelvin is: 300 Write a second program which then does the reverse conversion (using a difference of...
Write a Temperature class that will hold a temperature in Fahrenheit, and provide methods to get...
Write a Temperature class that will hold a temperature in Fahrenheit, and provide methods to get the temperature in Fahrenheit, Celsius and Kelvin. The class should have the following field: ftemp – A double that hold a Fahrenheit temperature. The class should have the following methods: Constructor – The constructor accepts a Fahrenheit temperature (as a double) and stores it in the ftemp field. setFahrenheit – The setFahrenheit method accepts a Fahrenheit temperature (as a double) and stores it in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT