Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Must be with jGRASP only please B01: Weight of water in a fish bowl The user has

ID: 3904113 • Letter: M

Question

Must be with jGRASP only please

B01: Weight of water in a fish bowl The user has a rectangle fish bowl with a solid cylinder in the middle, as displayed in the image attached. The height of the cylinder is the same as the height of the fish bowl. Write a program that will ask the user for the width, height and depth of the fish bowl, as well as the radius of the solid cylinder. These will be introduced as inches and your program needs to convert them to meters (1 inch = 0.0254 meters) Then, you need to compute the volume of the fish bowl that can be filled with water (volume of fish bowl - volume of the solid cylinder) in cubic meters. After you know how much water can be filled with water, your program needs to compute and display how much will that amount of water weigh (assume 1 cubic meter of water = 1,000 kg). Display the weight in pounds (1 pound = 1/2.2046 kg).

B02: Changing the text entered by the user Write a program that asks the user to enter 3 letters (let's assume the user will always enter a lowercase letter other than 'z'). Each time the user enters a character, your program will automatically get the following letter in the alphabet and then print it in uppercase. You cannot work with String methods such as .toUpperCase(), you need to work with char and integer operations. As an example, if the user enters 'd', your program would compute the following letter ('e') and print the equivalent in uppercase ('E')

B03: Check Write a program that will ask the user for the number of people that have gone out to eat at a restaurant for someone's birthday. All those people order the special, which is $9.95 per person. There is a special discount of 20% to apply that day. The service has been good, so you tip 20% after applying the discount. The tax applied after the discount is 5.5%. That would be the total for the group. The program should split the total, but the birthday person will not pay, so you divide the total between the rest of the group. Print how much each person must pay in the end. For instance: The user says 5 people are going out. 5 x $9.95 = $49.95 for the specials. $49.95 x 0.8 = $39.80 after the discount 20% of $39.80 = $7.96 for the tip Food after tax applying 5.5% tax: $41.99 Total after tax (food + tip): $41.99 + $7.96 = $49.95 Since there are 5 people, and one doesn't pay because it's his/her birthday, the rest pay: $49.95 / (5-1) = $49.95 / 4 = $12.49 each.

B04: Final grade Write a program that will compute the final numerical grade for students for a simplified version of this course. According to the syllabus, the final grade is split as follows: - Practice exercises: 15% - Graded quizzes: 15% - Homework exercises: 15% - Final exam: 35% - Midterm: 20% There are 2 practice exercises, 3 graded quizzes and 3 homework exercises. All practice exercises are worth the same, all graded quizzes are worth the same, and all the homework exercises are worth the same. Write a program that asks users to enter the grades (always from 0 to 100) obtained in the practice exercises, the graded quizzes, the homework exercises, the midterm and the final exam, and applying the weights previously displayed compute and display the final numerical grade obtained in the class.

Explanation / Answer

Hello. I have answered similar questions before, so I’m referring my own solution here. The image for first question is not visible, so I cannot write solution for first question. Here is the solutions for all the remaining questions i.e B02, B03 and B04. Thanks.

Answer for B02 (Changing the text entered by the user)

// TextChanger.java

import java.util.Scanner;

public class TextChanger {

                public static void main(String[] args) {

                                Scanner scanner = new Scanner(System.in);

                                for (int i = 0; i < 3; i++) {

                                                System.out.println("Enter a character: ");

                                                // getting character

                                                char c = scanner.nextLine().charAt(0);

                                                c++;// next character

                                                // finding the difference from 'a'

                                                int index = c - 'a';

                                                // adding the same difference to 'A' to convert into upper case

                                                c = (char) ('A' + index);

                                                //displaying the char

                                                System.out.println(c);

                                }

                }

} //end of second question’s answer

/*OUTPUT for B02*/

Enter a character:

d

E

Enter a character:

x

Y

Enter a character:

a

B

Answer for B03 (Check)

// Check.java

import java.util.Scanner;

public class Check {

                //required values

                static double PRICE_PER_PERSON = 9.95;

                static double DISCOUNT = 0.2; // 20%

                static double TIP = 0.2; // 20%

                static double TAX = 0.055; // 5.5%

                public static void main(String[] args) {

                                Scanner scanner = new Scanner(System.in);

                                System.out.print("How many people are going out?: ");

                                //getting number of persons, assuming n is greater than 1

                                int n = Integer.parseInt(scanner.nextLine());

                                //finding total cost

                                double total = n * PRICE_PER_PERSON;

                                //finding discount

                                double discount_applicable = total * DISCOUNT;

                                //deducting discount

                                total -= discount_applicable;

                                //finding tip amount

                                double tip_given = total * TIP;

                                //finding tax amount

                                double tax_applicable = total * TAX;

                                //adding tax and tip to the total

                                total += tax_applicable + tip_given;

                                //dividing equally for n-1 persons

                                double amount_per_person = total / (n - 1);

                                System.out.printf("Each person have to pay $%.2f ", amount_per_person);

                }

}//end of third question’s answer

/*OUTPUT for B03*/

How many people are going out?: 5

Each person have to pay $12.49

Answer for B04 (Final grade)

// FinalGrade.java

import java.util.Scanner;

public class FinalGrade {

                //percentage values

                static double PRACTICE = 0.15;

                static double GRADED = 0.15;

                static double HOMEWORK = 0.15;

                static double FINAL_EXAM = 0.35;

                static double MID_TERM = 0.20;

                public static void main(String[] args) {

                                Scanner scanner = new Scanner(System.in);

                                double practiceAverage = 0, gradesAverage = 0, homeworkAverage = 0;

                                double finalScore = 0, midtermScore = 0;

                                //getting 2 practice exam scores, assuming all input grades are valid

                                //and is between 0 and 100

                                for (int i = 1; i <= 2; i++) {

                                                System.out.print("Enter practice exam " + i + " score: ");

                                                practiceAverage += Double.parseDouble(scanner.nextLine());

                                }

                                //averaging the score

                                practiceAverage = practiceAverage / 2;

                                //getting 3 graded quiz scores

                                for (int i = 1; i <= 3; i++) {

                                                System.out.print("Enter graded quize " + i + " score: ");

                                                gradesAverage += Double.parseDouble(scanner.nextLine());

                                }

                                //averaging the score

                                gradesAverage = gradesAverage / 3;

                                //getting 3 homework scores

                                for (int i = 1; i <= 3; i++) {

                                                System.out.print("Enter homework " + i + " score: ");

                                                homeworkAverage += Double.parseDouble(scanner.nextLine());

                                }

                                //averaging the score

                                homeworkAverage = homeworkAverage / 3;

                                //getting midterm and final exam scores

                                System.out.print("Enter midterm score: ");

                                midtermScore = Double.parseDouble(scanner.nextLine());

                                System.out.print("Enter final exam score: ");

                                finalScore = Double.parseDouble(scanner.nextLine());

                                /**

                                * finding the final grade by applying appropriate percentage of each grades

                                */

                                double finalGrade = (practiceAverage * PRACTICE) + (gradesAverage * GRADED)

                                                                + (homeworkAverage * HOMEWORK) + (midtermScore * MID_TERM)

                                                                + (finalScore * FINAL_EXAM);

                                System.out.printf("Final grade: %.2f ",finalGrade);

                }

}//end of fourth question’s answer

/*OUTPUT for B04*/

Enter practice exam 1 score: 95

Enter practice exam 2 score: 79

Enter graded quize 1 score: 90

Enter graded quize 2 score: 95

Enter graded quize 3 score: 96

Enter homework 1 score: 100

Enter homework 2 score: 100

Enter homework 3 score: 98

Enter midterm score: 67

Enter final exam score: 98

Final grade: 89.70