Explanation of Solution
Program code:
BookStoreCredit.java
//import the required packages
import java.util.Scanner;
//define a class BookStoreCredit
public class BookStoreCredit
{
//define the main method
public static void main(String[] args)
{
//create object of Scanner
Scanner scanner = null;
//create a try...catch block
try
{
//scannner object
scanner = new Scanner(System.in);
// prompt to read name of student
System.out.print("Enter the Student name:");
//get the name to studentName
String studentName = scanner.next();
// prompt to read grade point average of student
System.out.print("Enter the Student grade point average:");
//get the input to gradePointAvg
double gradePointAvg = scanner.nextDouble();
// method call
display(studentName, gradePointAvg);
//catch the exception e
} catch (Exception e)
{
}
}
//define a method display()
public static void display(String studentName, double gradePointAvg)
{
//print the values
System.out.println("Student Name:" + studentName);
System.out.println("Grade point Average:" + gradePointAvg);
// compute the credit and display
System...
Trending nowThis is a popular solution!
Chapter 3 Solutions
Java Programming (MindTap Course List)
- Create a method where a goblin will attack a zombie as long as the zombie has no health, otherwise the zombie is already dead. If the zombie has 0 or less health, the attack method should add 10 health to the zombie, bringing them closer to being alive so that they will be dead it should then return the zombies health. If the health of the zombie is positive the attack method should return "Zombie is alive, therefore it is not a zombie!". NOTE: This problem statement is extremely vague. This is to test how well you follow directions.arrow_forwardCreate a program named PaintingEstimate whose Main() method prompts a user for length and width of a room in feet. Create a method that accepts the values and then computes the cost of painting the room, assuming the room is rectangular and has four full walls and 9-foot ceilings. The price of the job is $6 per square foot. Return the price to the Main() method, and display it. An example of the program is shown below: Enter length of the room in feet >> 30 Enter width of room in feet >> 16 Cost of job for 30 X 16 foot room is $4,968.00 In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US"))); using System; using static System.Console; using System.Globalization; class…arrow_forwardThe L&L Bank can handle up to 30 customers who have savings accounts. Design and implement a program that manages the accounts. Keep track of key information, and allow each customer to make deposits and withdrawals. Produce appropriate error messages for invalid transactions. Hint: You may want to baseyour accounts on the Account class from Chapter 5. Also provide a method to add 3 percent interest to all accounts whenever the method is invoked.arrow_forward
- Part 1 Motto Crispy Catering provides meals for parties and special events. Write a program that displays Crispy Catering's motto: "Crispy makes the food that makes it a party!" Display the motto surrounded by a border of asterisks. Put the code to display the motto in a method called, public void displayMotto () Run the program and save a screenshot of the output (save as screenshot 1)arrow_forwardCreate a code that will run.arrow_forwardCreate a method "public void giveRaise(int percentage)" in the Employee class. This method should increase the salary member by the percentage specified in the parameter. In the main method: 1. Create an Employee object. Print out its toString() result. Call giveRaise with 10%. 2. Print out its toString() result.arrow_forward
- Write a method that takes your name and your expected year of graduation and prints that information .Call this method from your main method, which takes user input and passes it to the method, described above. Name the program Lab27.java Add comments and upload it to the dropbox. Name: Miles Grear Expected year of graduation: 2024arrow_forwardWrite a main method, in which you should have an Arralylist of students, in which you should include every student. You should have a PhD student named Joe Smith. In addition, you should create an Undergraduate student object for each of your team members (setting their names). If you’re only one person doing the assignment, then you should just create one undergraduate object. For each undergraduate student, you should add add two courses (COIS 2240 and COIS 1020). Loop over the arraylist of students, print their names, if the student is an undergraduate student, print their courses.arrow_forwardStarting Out with Java From Control Structures through Objects 6th Editionarrow_forward
- Please help me with this Java Labarrow_forwardCan you write it in JAVA programming language Add a toString method to your Account class. For the purposes of this assignment, please use the toString display the following: This account contains $x. You have earned $y in the last month. where x is the account balance (please don't format the decimals) and y is the monthly interest earned, obtained from the getMonthlyInterest method. Compile and test in a driver by creating and printing an Account object. Add an equals method to your Account class. Two Account objects are equal if their balance and annualInterestRates are equal. Compile and test in your driver by creating 2 Account objects to see if they are equal.arrow_forwardGiven the code below, write a method call for the method (assume that each parameter is a String). Then determine that method’s output given the arguments that you pass. METHOD trickOrTreat (parameters: candy) BEGIN CREATE treat ← 26 SWITCH candy CASE “Tootsie Roll”: treat ++ CASE “Candy Corn”: treat += 2 BREAK CASE “Twizzlers”: treat -= 2 CASE “Dots”: treat -- CASE “Kit Kat”: treat *= 2 END SWITCH RETURN treat END METHOD Method Call Exact Outputarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,