We would take the example of gradation system in the examination. We would consider that the full mark is 100. A student gets 90 or above then the grade becomes O, 80 or above then grade becomes E, 70 or above grade becomes A, 60 or above grade becomes B, 50 or above, the grade becomes C and below 50 is fail(gets grade D). We would check results for 30 students inside the class.
So, the user would input the grade and would know the range of number a student can get.
The code snippet in here below:
char grade;
for(int i = 1;i<=30;i++)
{
switch (grade) {
case O:
{
System.out.println(" Student has scored more than 90");
status = "P";
break;
}
case E:
{
System.out.println(" Student has scored more than 80 but lesser than 90");
status = "P";
break;
}
case A:
{
System.out.println(" Student has scored more than 70 but lesser than 80");
status = "P";
break;
}
case B:
{
System.out.println(" Student has scored more than 60 but lesser than 70");
status = "P";
break;
}
case C:
{
System.out.println(" Student has scored more than 50 lesser than 60");
status = "P";
break;
}
case D:
{
System.out.println(" Student has scored lesser than 50 ");
status = "F";
break;
}
default:
System.out.println(" Invalid grade");
break;
}
switch(status)
{
case P:
{
System.out.println("The student is promoted");
break;
}
case F:
{
System.out.println("The student has failed");
break;
}
default:
{
System.out.println("Unknown status");
break;
}
}
}
post a brief description of a problem which to program a solution would require complex decisions...
Desgin a state graph and state table of a state machine simulating the control of an automatic car wash. Depending on inputs from the user, the simulator will cycle through states representing inactive, rinse #1, soap spray, scrub, rinse #2, wax, rinse #3. There will be three inputs. One ("start") will activate the car wash, one ("deluxe") will choose between a normal cycle (skip the last two steps of wax, rinse #3) and a deluxe cycle, and one ("kill") will...
this needs to be in Java:
use a comparator class which
is passed into the sort method that is available on the
ArrayList.
import java.util.Scanner;
public class Assign1{
public static
void main(String[] args){
Scanner reader = new Scanner (System.in);
MyDate todayDate = new MyDate();
int choice = 0;
Library library = new Library();
while (choice != 6){
displayMainMenu();
if (reader.hasNextInt()){
choice = reader.nextInt();
switch(choice){
case 1:
library.inputResource(reader, todayDate);
break;
case 2:
System.out.println(library.resourcesOverDue(todayDate));
break;
case 3:
System.out.println(library.toString());
break;
case 4:
library.deleteResource(reader,...
Write up a detailed solution to the problem: Design a program to convert a Roman numeral to a decimal number. The program should read a Roman numeral. You may read it as a string or one character at a time. Do the conversion and then output the decimal number. Here are the “letters” you need to know: Symbol = Value I = 1 V = 5 X = 10 L = 50 C = 100 D = 500 M =...
what would be my percent yield if i retrieved 3.1020 grams of
soap? thank you, please show all work.
SAPONIFICATION (HYDROLYSIS OF A FAD Fats and edible oils consitute a special class of esters called riglycerides in which alcohol part of the molecule, the trihydroxy compound glycerol, forms with three molecules of various long-chain carboxylic acids (called fatty acids). Ty reactions of simple esters can also be carried out on fats and oils,i acid-or-base-catalyzed hydrolysis. three ester linkages carboxylic acids...
/***************************************************
Name:
Date:
Homework #7
Program name: HexUtilitySOLUTION
Program description: Accepts hexadecimal numbers as input.
Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE
Enter BYE (case insensitive) to exit the program.
****************************************************/
import java.util.Scanner;
public class HexUtilitySOLUTION {
public static void main(String[] args) {
// Maximum length of input string
final byte INPUT_LENGTH = 4;
String userInput = ""; // Initialize to null string
Scanner input = new Scanner(System.in);
// Process the inputs until BYE is entered
do {...
Problem Statement: A company intends to offer various versions of roulette game and it wants you to develop a customized object-oriented software solution. This company plans to offer one version 100A now (similar to the simple version in project 2 so refer to it for basic requirements, but it allows multiple players and multiple games) and it is planning to add several more versions in the future. Each game has a minimum and maximum bet and it shall be able...
Lab 1.java only Goal: This lab will give you experience with defining and using classes and fields, and with conditionals and recursive functions. Getting Started --------------- Read the Fraction.java class into a text editor and compile it filling in the command javac -g Fraction.java. The program should compile without errors. In a shell window, run the program using "java Fraction". The program should run, although it will print fractions in a non-reduced form, like 12/20. Part I: Constructors (1 point)...
You will be writing a simple Java program that implements an ancient form of encryption known as a substitution cipher or a Caesar cipher (after Julius Caesar, who reportedly used it to send messages to his armies) or a shift cipher. In a Caesar cipher, the letters in a message are replaced by the letters of a "shifted" alphabet. So for example if we had a shift of 3 we might have the following replacements: Original alphabet: A B C...
C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the...
QUESTIONS TO ANSWER:
Prepare a table of all chemicals used with the structure and
purpose of each.
Calculate the theoretical yield by finding limiting reactant of
the experiment by converting reactants to product (remember to show
all calculations used)
Calculate the percent yield using the limiting reactant
Calculate the Rf for triphenylmethanol. If there are two dots,
determine which one is triphenylmethanol.. ( I did not provide
data. Please let me know how I Would do this if I did)...