Java I am stuck on, enter a number grade: 9.8 ERROR: 9.8 and enter a number grade: 10 ERROR: 10 Here is the specs Write a class called Grades. Grades must have a main method (see example of what the main method does below). Grades are values between zero and 10 (both zero and 10 included), and are always rounded to the nearest half point (i.e. ALL GRADES entered in the system end in either .0 or .5). To translate grades to letters: 8.5 to 10.0 become an "A," 7.5 and 8.0 become a "B," 6.5 and 7.0 become a "C," 5.5 and 6.0 become a "D," and 0.0 to 5.0 become an "F." Anything else is an error. Implement a program such that, it asks the user for a grade, and then it prints the corresponding letter. If the user enters a grade lower than zero or higher than 10, print an error message (as in example below). ALL GRADES MUST END IN EITHER .0 or .5, including 10.0 and 0.0.
% java Grades enter a number grade: 11.0 ERROR: 11.0 % java Grades enter a number grade: 11 ERROR: 11 % java Grades enter a number grade: 10 ERROR: 10 % java Grades enter a number grade: 10.0 letter grade is A % java Grades enter a number grade: 9.8 ERROR: 9.8 % java Grades enter a number grade: 9.5 letter grade is A % java Grades enter a number grade: 9.0 letter grade is A % java Grades enter a number grade: 9 ERROR: 9 % java Grades enter a number grade: 8.5 letter grade is A % java Grades enter a number grade: 8.0 letter grade is B % java Grades enter a number grade: 7.5 letter grade is B % java Grades enter a number grade: 7.0 letter grade is C % java Grades enter a number grade: 6.0 letter grade is D % java Grades enter a number grade: 5.5 letter grade is D % java Grades enter a number grade: 5.0 letter grade is F % java Grades enter a number grade: 3.0 letter grade is F % java Grades enter a number grade: 0.0 letter grade is F % java Grades enter a number grade: 0 ERROR: 0 % java Grades enter a number grade: -1 ERROR: -1 % java Grades enter a number grade: 0.1 ERROR: 0.1 % java Grades enter a number grade: 9.51 ERROR: 9.51 % java Grades enter a number grade: 9.000001 ERROR: 9.000001 %
package proj;
import java.util.Date;
import java.util.Scanner;
public class Grade {
public static void main(String[] args) {
Scanner sc=new
Scanner(System.in);
System.out.print("enter a number
grade:");
String s=sc.next();
if(!s.contains(".")){
System.out.println("Error: "+s);
return;
}
double
grade=Double.parseDouble(s);
double frac=(grade*10)%10; // to
check whether grade entered end with .0 or .5 or not
// (grade * 10) %10 it will return
last digit of grade it that last digit is not either 5.0 or
0.0
// then return error
//ex grade =8.4 so 8.4*10=>
84.0=> 84%10 => 4 so this grade does not follow condition
return erro
if(frac!=0.0 && frac!=5.0)
{
System.out.println("Error: "+grade);
return;
}
//else follow rules defined in
question
if(grade>=8.5 &&
grade<=10.0){
System.out.println("letter grade is A");
}
else if(grade>=7.5 &&
grade<=8.0){
System.out.println("letter grade is B");
}
else if(grade>=6.5 &&
grade<=7.0){
System.out.println("letter grade is C");
}
else if(grade>=5.5 &&
grade<=6.0){
System.out.println("letter grade is D");
}
else if(grade>=0.0 &&
grade<=5.0){
System.out.println("letter grade is F");
}
else{
System.out.println("Error: "+grade);
}
}
}
OUTPUT
enter a number grade:11.0
Error: 11.0
enter a number grade:11
Error: 11.0
enter a number grade:10
Error: 10
enter a number grade:10.0
letter grade is A
enter a number grade:9.8
Error: 9.8
enter a number grade:9.5
letter grade is A
enter a number grade:9.0
letter grade is A
enter a number grade:9
Error: 9
enter a number grade:8.5
letter grade is A
enter a number grade:8.0
letter grade is B
enter a number grade:7.5
letter grade is B
enter a number grade:0.0
letter grade is F
enter a number grade:-1
Error: -1
enter a number grade:9.51
Error: 9.51
enter a number grade:9.00001
Error: 9.00001
Java I am stuck on, enter a number grade: 9.8 ERROR: 9.8 and enter a number...
3. Based on the integration of the peaks, what is the relative number of protons which make up each signal? 4. Identify any common splitting patterns. (ie. Isopropyl, ethyl, etc) UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
analyze this NMR & IR S23 CDC13 QE-300 240 UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
Fill out the tables below of the starting material and pure product by using the given NMR spectrums. Identify if the pure isomer of methyl nitrobenzoate as ortho, meta, or para. Complete the table below using your proton NMR spectrum of your starting material. Be sure to include all peaks. Note: The table is expandable. Use the structure below for the letter assignments in your table. Splitting Integration Assignment Peak (ppm) Other Notes -7.95 -7.92 0627 -787 785 7.30 751...
7. What kind of carbons correspond to these chemical shifts? 8. Based on this analysis, the unknown might contain the following substructure: UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
5. Based on this analysis, the compound might be or contain the following substructure: 6. How many different types of carbons appear to be present? What are the chemical shifts for these carbons? UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
A variety of spectra for an organic compound with molecular formula C10H16O are presented below. The experimental accurate mass using (+) APCI source is 153.1280 u. The 1H, 13C, COSY, HSQC and HMBC NMR spectra are given in the following slides. Propose a structure for this unknown and answer or address the following questions or requirements: d. If there are still any questionable assignments, propose additional NMR experiments which would solve those questions and briefly explain specifically what correlations you...
A variety of spectra for an organic compound with molecular formula C10H16O are presented below. The experimental accurate mass using (+) APCI source is 153.1280 u. The 1H, 13C, COSY, HSQC and HMBC NMR spectra are given in the following slides. Propose a structure for this unknown and answer or address the following questions or requirements: a. Using the most abundant isotopes of C, H and O, what are the errors in ppm and milli-Daltons for the experimental accurate mass?...
1. How many different types of protons appear to be present? What are the chemical shifts for these protons? What does this indicate (if anything) about the electronic environment of the protons? 2. What are the multiplicities for each peak? UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
V. Draw the structures of Compound 23A (6 pts), Compound 23B (6 pts) and clearly indicate your assignments of all proton resonances using the lower case letter associated with the signal (6 pts). Calculate the Unsaturation Index of each compound (2 pts) (20 points total) 1.24 3.0 1.26 2.5 e = 1.25 ppm doublet, 6H 2.0 a = 10.0 ppm 1.5 Compound 23a: C10H420 singlet, 1H 10.00 7.83 7.85 7.09 7.07 1.0 Unsat. Index = (2C+2-H-X+N)/2 = X=number of halogens...
V. Draw the structures of Compound 23A (6 pts), Compound 23B (6 pts) and clearly indicate your assignments of all proton resonances using the lower case letter associated with the signal (6 pts). Calculate the Unsaturation Index of each compound (2 pts) (20 points total) 1.24 3.0 1.26 2.5 e = 1.25 ppm doublet, 6H 2.0 a = 10.0 ppm 1.5 Compound 23a: C10H420 singlet, 1H 10.00 7.83 7.85 7.09 7.07 1.0 Unsat. Index = (2C+2-H-X+N)/2 = X=number of halogens...