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: | 364 Weeks Ago, 4 Days Ago |
| Questions Answered: | 1850 |
| Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
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);
Â
  }
Â
}
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I