Question

In: Computer Science

To encourage good grades, Hermosa High School has decided to award each student a bookstore credit...

To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’s grade point average. In other words, a student with a 3.2 grade point average receives a $32.0 credit. Create an application that prompts a student for a name and grade point average, and then passes the values to a method (computeDiscount) that displays a descriptive message. The message uses the student’s name, echoes the grade point average, and computes and displays the credit, as follows: John, your GPA is 3.4, so your credit is $34.0. Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.

Solutions

Expert Solution

ANSWER - Java Code is pasted below

import java.util.Scanner;
class GradePoint{
//member variables
String name;
double grade;
//method for computing discount
void computeDiscount(String name,double grade)
{
this.name=name;
this.grade=grade;
//giving 10 times grade
double grade10=grade*10;
System.out.println(name+", your GPA is "+grade+",so your credit is $"+grade10);
}
}
class GradePointDemo{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the student name:");
String name=sc.nextLine();
System.out.println("Enter the grade:");
double grade=sc.nextDouble();
//creating object of the class
GradePoint gp=new GradePoint();
//calling the method computeDiscount
gp.computeDiscount(name,grade);
}
}

Output Screen


Related Solutions

Your company has decided to award a prize to a high school learner in your town...
Your company has decided to award a prize to a high school learner in your town for the best essay on peace. Write a press release of about 150 words to announce this competition and to give information about the rules. 25 marks
Students in a high school were asked whether good grades, athletic ability, or popularity was most...
Students in a high school were asked whether good grades, athletic ability, or popularity was most important to them. A two-way table separating the students by gender and by choice of most important factor (factor) is shown below: Boys Girls Grades 12 16 Popularity 16 32 Sports 30 14 100 For the data above, do the following Calculate the row and column totals Calculate gender by factor percentages Calculate factor by gender percentages What is the test to be done...
The student population of the Corona High School is 750. The school has 25 standard classrooms....
The student population of the Corona High School is 750. The school has 25 standard classrooms. Assuming a 5-day school week with solid waste pickups on Monday and Thursday, determine the lowest cost combination of waste containers required. Assume waste is generated at a rate of 0.10 kg/cap·day plus 4 kg per room per day and that the density of uncompacted solid waste is 120.0 kg/m3. Standard container sizes available and weekly rental fees are: 1.5 m3 @ $45 /...
A nationwide award for high school students is given to outstanding students who are sophomores, juniors,...
A nationwide award for high school students is given to outstanding students who are sophomores, juniors, or seniors (freshmen are not eligible). Of the award-winners, 65 percent are SENIORS, 20 percent JUNIORS, and 15 percent are SOPHOMORES. Note: Your answers should be expressed as decimals rounded to three decimal places. (a) Suppose we select award-winners one at a time and continue selecting until a SENIOR is selected. What is the probability that we will select exactly three award-winners? (b) Suppose...
A nationwide award for high school students is given to outstanding students who are sophomores, juniors,...
A nationwide award for high school students is given to outstanding students who are sophomores, juniors, or seniors (freshmen are not eligible). Of the award-winners, 60 percent are SENIORS, 24 percent JUNIORS, and 16 percent are SOPHOMORES. Note: Your answers should be expressed as decimals rounded to three decimal places. (a) Suppose we select award-winners one at a time and continue selecting until a SENIOR is selected. What is the probability that we will select exactly three award-winners? (b) Suppose...
Emily, who was active in sports throughout high school, has decided to run a marathon with...
Emily, who was active in sports throughout high school, has decided to run a marathon with some of her friends. She is 27 years old, 5 ft 7 in tall, and weighs 125 pounds. She eats all kinds of foods, likes fruits and vegetables, but tries to avoid fatty foods. She says coffee is her downfall—she drinks 6 cups a day. She doesn’t like sweets, although she keeps ice cream in her freezer. A family history notes that her mother  ...
Prepare balance sheets for end of each semester. Edwina Haskell was an accomplished high school student...
Prepare balance sheets for end of each semester. Edwina Haskell was an accomplished high school student who looked forward to attending Southern New England University (SNEU). SNEU was unique in that it operated on a trimester basis, its policy was to actively foster independent development among the students. Edwina’s mother and father each own their own small businesses. Soon after freshman orientation at SNEU, Edwina recognized a need among the students that could be the basis for developing a small...
b) A high-school student has a monthly budget of $80 to spend on music and burritos....
b) A high-school student has a monthly budget of $80 to spend on music and burritos. Burritos cost $8 each, while songs are free after paying the Spotify monthly fee of $9.99. 1. In a diagram, measuring songs along the horizontal axis, draw the high-school student’s budget constraint. c) A family has an yearly income of $50,000 to spend on the kids’ education or on all other goods. 1. In a diagram measuring dollars spent on education along the horizontal...
Kristen, who was active in competitive sports throughout high school, has decided to run a marathon...
Kristen, who was active in competitive sports throughout high school, has decided to run a marathon with some of her college friends. She has started training and monitors her miles, time, and calories using a wrist band and training app. She is 25 years old, 5 ft, 8 in. tall, and weighs 135 lb. She eats all sorts of foods, likes fruits and vegetables, but tries to avoid greasy foods. She says coffee is her downfall—she drinks 4–6 cups a...
A researcher wanted to see if motivation scale, grades in high school, and parents’ education predict...
A researcher wanted to see if motivation scale, grades in high school, and parents’ education predict students’ math achievement. The researcher conducted an analysis and got the following ANOVAb model Sum of squares df Mean square f sig Regression Residual Total 1509.723 1777.353 3287.076 4 68 72 377.431 26.138 14.44. .000a Predictors:(constant),gender,gradesinh.s.,motivationscale,parent’seducation Dependentvariable:mathachievementtest                                                                coefficientsa model Unstandized coefficienis Standardized coefficienis t sig collia B Std. error Beta Tolera (constant) Motivation scalegrades h.s. parent’s education gender -5.444 2.148 1.991 .580 -3.631...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT