The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 2 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
New to Computer Science Java world. Below is my source code and it runs fine. I am trying to add in a month to year conversion to be displayed in the output. Additionally, I was able to have a Celsius output, but need to display Fahrenheit as well. I feel this is very simple, but I am not seeing what I need to do. Please explain.
Â
import java.util.Scanner;
Â
public class DataSurvey {
Â
  public static void main(String[] args) {
    int EMPLID, age;
    Double quiz1, quiz2, quiz3, temperatureInFahrenheit, temperatureInDegrees, average;
    Scanner input = new Scanner(System.in);
    System.out.print("Enter your Student EMPLID :");
    EMPLID = input.nextInt();
    if (EMPLID <= 0 || EMPLID > 999999) {
      do {
        System.out.println("EMPLID must be between 0-999999");
        System.out.print("Enter your Student EMPLID again :");
        EMPLID = input.nextInt();
Â
      } while (EMPLID <= 0 || EMPLID > 999999);
    }
Â
    System.out.print("Enter your quiz1 percentage score :");
    quiz1 = input.nextDouble();
    if (quiz1 <= 0 || quiz1 > 100) {
      do {
        System.out.println("Must be between 0-100");
        System.out.print("Enter your Quiz 1 percentage score again :");
        quiz1 = input.nextDouble();
Â
      } while (quiz1 <= 0 || quiz1 > 100);
    }
    System.out.print("Enter your quiz2 percentage score :");
    quiz2 = input.nextDouble();
    if (quiz2 <= 0 || quiz2 > 100) {
      do {
        System.out.println("Must be between 0-100");
        System.out.print("Enter your quiz2 percentage score again :");
        quiz2 = input.nextDouble();
Â
      } while (quiz2 <= 0 || quiz2 > 100);
    }
Â
System.out.print("Enter your quiz3 percentage score :");
    quiz3 = input.nextDouble();
    if (quiz3 <= 0 || quiz3 > 100) {
      do {
        System.out.println("Must be between 0-100");
        System.out.print("Enter your Quiz 3 percentage score again :");
        quiz3 = input.nextDouble();
Â
      } while (quiz3 <= 0 || quiz3 > 100);
    }
Â
    System.out.print("Enter your age in months :");
    age = input.nextInt();
    if (age <= 0 || age > 1440) {
      do {
        System.out.println("Must be between 0-1440");
        System.out.print("Enter your age again :");
        age = input.nextInt();
Â
      } while (age <= 0 || age > 1440);
    }
    System.out.print("Enter the current outdoor Temperature in degrees Fahrenheit:");
    temperatureInFahrenheit = input.nextDouble();
Â
    average = (quiz1 + quiz2 + quiz3) / 3.0;
    temperatureInDegrees = ((temperatureInFahrenheit - 32) * 5) / 9;
Â
    System.out.println("******* Thank you for your Time *******");
    System.out.println("Student EMPLID: " + EMPLID);
    System.out.println("Quiz 1 Score: " + quiz1);
    System.out.println("Quiz 2 Score: " + quiz2);
System.out.println("Quiz 3 Score: " + quiz3);
    System.out.println("Average quiz score: " + average);
    System.out.printf("Temperature in Celsius: %4.2fu00b0", temperatureInDegrees);
    System.out.println();
    System.out.println("Age: " + age);
Â
  }
Â
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly