import javautil Scanner Conditionals warmup Assignment For u
Solution
Hello could you please clarify the TODO 11 and 15.I have so doubt regarding that.Could you please eloborate those two.So that I can complete those two also so that which will meet your EXACT requirement .Thank You.
ConditionalsWarmup.java
import java.util.Scanner;
public class ConditionalsWarmup {
public static void main(String[] args) {
Scanner keyboard=new Scanner(System.in);
//TODO 1
System.out.print(\"Enter the number for TODO 1:\");
int number=keyboard.nextInt();
if(number<0)
System.out.println(\":: The Number is negative ::\");
//TODO 2
System.out.print(\"Enter a Second number :\");
number=keyboard.nextInt();
if(number==0)
System.out.println(\":: The Number is Zero ::\");
//TODO 3
double average;
System.out.println(\":: Enter a double for the class Average ::\");
average=keyboard.nextDouble();
if(average>=65.0)
System.out.println(\":: A Passing Grade ::\");
else if(average<65.0)
System.out.println(\":: Average is below 65.0 ::\");
//TODO 4 and TODO 5
boolean answer;
System.out.print(\"Enter a Boolean value: \");
answer=keyboard.nextBoolean();
if(answer==true)
System.out.println(\":: The value was true ::\");
else
System.out.println(\":: The value was false ::\");
//TODO 6
System.out.print(\"Enter a number :\");
number=keyboard.nextInt();
if(number%2==0)
System.out.println(\":: The Number is Even ::\");
else
System.out.println(\":: The Number is odd ::\");
//TODO 7
float grade=0.0f;
grade=keyboard.nextFloat();
if(grade>89.5f)
System.out.println(\":: The grade is an A ::\");
//TODO 8
else if(grade>83.49 && grade<90)
System.out.println(\":: The grade is B ::\");
else if(grade>75.0 && grade<83.49)
System.out.println(\":: The grade is C ::\");
System.out.println(\":: The grade is B ::\");
//TODO 9
int temperature=0;
System.out.print(\"Enter the Temperature :\");
temperature=keyboard.nextInt();
if(temperature>78)
System.out.println(\":: Current Temperature is Higher than 78 degrees ::\");
else if(temperature<=78)
System.out.println(\":: Current Temperature is Less than or equal to degrees ::\");
//TODO 10
System.out.print(\"Enter a number :\");
number=keyboard.nextInt();
if((number>0 && number%2!=0) || number==0 || (number<0 && number%2==0))
System.out.println(\"The number is either positive and odd,Zero,or negative and even :\");
else
System.out.println(\"The number is must be positive and even ,or negative and odd :\");
//TODO 11
char lettergrade=0;
System.out.print(\"Enter a Letter Grade :\");
lettergrade=keyboard.next(\".\").charAt(0);
//TODO 12
int maximum,x,y;
System.out.print(\"Enter First Number :\");
x=keyboard.nextInt();
System.out.print(\"Enter Second Number :\");
y=keyboard.nextInt();
maximum=max(x,y);
System.out.println(\"The Maximum of two numbers is :\"+maximum);
if(x>y)
System.out.println(\":: \"+x+\" was larger than \"+y+\" ::\");
else if(x<y)
System.out.println(\":: \"+y+\" was larger than \"+x+\" ::\");
else if(x==y)
System.out.println(\":: \"+x+\" is Equal to \"+x+\" ::\");
//TODO 15
lettergrade=keyboard.next(\".\").charAt(0);
switch(lettergrade)
{
}
}
private static int max(int a, int b) {
int max=0;
if(a>b)
max=a;
else
max=b;
return max;
}
}
______________________________________


