Hi, first time on here so hope i am in the right place. I have created the methods gradeTemp and getValidTemp, which i can run independently. However when i attempt to call them both in tempGrading i cannot. To be clear what I am trying to do in tempGrading method is call getValid temp to provide me with a temp for which I can then call gradeTemp to give a rating. In addition to the code below I have tried including in tempGrading: vTemp= temp; rating=gradeTemp(vTemp); but cant make work in either case.
import java.util.*;
public class Temperature
{
static void gradeTemp() {
int temp;
Scanner sc=new Scanner(System.in);
System.out.println("Enter temperature");
temp = sc.nextInt();
System.out.print("The temp is ");
if(temp>=70 && temp<=100) {
System.out.println("Very Hot");
} else if (temp>=60 && temp<=69) {
System.out.println("Hot");
}
else if (temp>=50 && temp<=59) {
System.out.println("Warm");}
else if (temp>=40 && temp<=49) {
System.out.println("Cool");}
else if (temp>=0 && temp<=39) {
System.out.println("Cold");}
}
public static int getValidTemp() {
Scanner sc=new Scanner(System.in);
int temp;
System.out.println ("Enter a Temperature in range 0 to 100");
mark=sc.nextInt();
while (temp < 0 || temp > 100)
{
System.out.println("Invalid temperature !");
System.out.println ("Enter a mark in range 0 to 100");
mark=sc.nextInt();
}
return mark;}
public void tempGrading() {
Scanner sc=new Scanner(System.in);
char response;
int temp, vTemp;
System.out.println("*********** Temperature Grading *********");
System.out.println("Enter temperature to receive rating");
do {
String rating;
temp = getValidTemp();
rating= gradeTemp();
System.out.println("Your rating is" + rating);
System.out.print("another go (y/n)? =>");
response = sc.next().charAt(0);
} while (response == 'y'|| response =='Y');
}
}