-1

I am learning programming and have issues with my code but I don't understand the error.

enter image description here

please see my code below

class Main {
  public static double calcAvg(double q1, double q2, double q3) {
    return (q1 + q2 + q3) / 3.0;
  }

  public static int ageInYears(int months) {
    return months / 12;
  }

  public static double convertCtoF(double C) {
    return (C * 9.0 / 5.0) + 32.0;
  }

  public static void main(String[] args) {
    Scanner in = new scanner (System.in);
    System.out.print("Enter employee ID: ");
    String empID = in.nextLine();

    System.out.print("Enter quiz 1 score: ");
    double quiz1 = in.nextDouble();
    in.nextLine();

    System.out.print("Enter quiz 2 score: ");
    double quiz2 = in.nextDouble();
    in.nextLine();

    System.out.print("Enter quiz 3 score: ");
    double quiz3 = in.nextDouble();
    in.nextLine();

    System.out.print("Enter age in months: ");
    int age = in.nextInt();
    in.nextLine();

    System.out.print("Enter temp in Celsius: ");
    double celsius = in.nextDouble();
    in.nextLine();

    System.out.printf("Employee ID: %s\n", empID);
    System.out.printf("Avg quiz score: %f\n", calcAvg(quiz1, quiz2, quiz3));
    System.out.printf("Age in years: %d\n", ageInYears(age));
    System.out.printf("Temp in Fahrenheit: %f\n", convertCtoF(celsius));
  }
}

1 Answers1

0

Add an import to Scanner and also write Scanner and not scanner when initializing

import java.util.Scanner;

public class Main {
    // ....
         Scanner sc = new Scanner(System.in);
}
b.GHILAS
  • 2,273
  • 1
  • 8
  • 16