
Explanation of Solution
a.
CarlysEventPriceWithMethods.java
//import the required packages
import java.util.Scanner;
//define a method CarlysEventPriceWithMethods
public class CarlysEventPriceWithMethods
{
//Scanner object
private static Scanner sc = new Scanner(System.in);
//define a method getEventNum()
public static String getEventNum()
{
//print the statement
System.out.println("Enter event number: ");
//scan the values
return sc.next();
}
//define the method getNoGuests
public static int getNoOfGuests()
{
//print the statement
System.out.println("Enter no of guests: ");
//return the value scanned
return sc.nextInt();
}
//define the method displayMotto()
public static void displayMotto(Event e)
{
//prin the values
System.out.println(String.format("%26s", " ").replace(" ", "*"));
System.out.printf("* %22s *", " ");
System.out.println("\n* Carly’s Catering *");
System.out.printf("* %22s *\n", " ");
System.out.println(String.format("%26s", " ").replace(" ", "*"));
System.out.println("Event No: " + e.getEventNum());
System.out.println("No. of guests:" + e.getNoOfGuest());
System.out.println("Price per guest: $" + Event.PRICE_PER_GUEST);
//call the method computePrice
computePrice(e);
}
//define the method computePrice
public static void computePrice(Event e)
{
//print the values
System.out.println("Price: $" + e.getPrice());
System.out.println("Large event: " + ((e.getNoOfGuest() > Event.CUT_OFF) ? "Yes" : "No"));
}
//define the main method
public static void main(String[] args)
{
//Close scanner
sc.close();
}
}
Explanation:
The above snippet of code is used to create a class “CarlysEventPriceWithMethods”. In the code,
- Import the required header files.
- Define a class “CarlysEventPriceWithMethods”
- Declare the object of “Scanner” class.
- Define the “getEventNum()” method.
- Prompt the user to enter the event number.
- Return the value of “name”.
- Define the “getNoGuests()” method.
- Return the scanned value.
- Define the “displayMotto()” method.
- Print the values.
- Call the method “computePrice()”.
- Define the “computePrice()” method.
- Print the values.
- Define the “main()” method.
- Close the scanner.
b.
Event.java
//define a class Event
public class Event
{
//declare the class members
public final static int PRICE_PER_GUEST = 35;
public final static int CUT_OFF = 50;
private String eventNum;
private int noOfGuest;
private int price;
//define a method setEventNum()
public void setEventNum(String eventNum)
{
//set the value of eventNum
this.eventNum = eventNum;
}
//define a method setNoOfGuest()
public void setNoOfGuest(int noOfGuest)
{
//set the values of noOfGuest
this.noOfGuest = noOfGuest;
//set the values of price
this...

Trending nowThis is a popular solution!

Chapter 3 Solutions
EBK JAVA PROGRAMMING
- Please show the code for the Tikz figure of the complex plane and the curve C. Also, mark all singularities of the integrand.arrow_forward11. Go to the Webinars worksheet. DeShawn wants to determine the number of webinars the company can hold on Tuesdays and Thursdays to make the highest weekly profit without interfering with consultations, which are also scheduled for Tuesdays and Thursdays and use the same resources. Use Solver to find this information as follows: a. Use Total weekly profit as the objective cell in the Solver model, with the goal of determining the maximum value for that cell. b. Use the number of Tuesday and Thursday sessions for the five programs as the changing variable cells. c. Determine and enter the constraints based on the information provided in Table 3. d. Use Simplex LP as the solving method to find a global optimal solution. e. Save the Solver model below the Maximum weekly profit model label. f. Solve the model, keeping the Solver solution. Table 3: Solver Constraints Constraint Cell or Range Each webinar is scheduled at least once on Tuesday and once on Thursday B4:F5 Each Tuesday and…arrow_forwardGo to the Webinars DeShawn wants to determine the number of webinars the company can hold on Tuesdays and Thursdays to make the highest weekly profit without interfering with consultations, which are also scheduled for Tuesdays and Thursdays and use the same resources. Use Solver to find this information as follows: Use Total weekly profit as the objective cell in the Solver model, with the goal of determining the maximum value for that cell. Use the number of Tuesday and Thursday sessions for the five programs as the changing variable cells. Determine and enter the constraints based on the information provided in Table 3. Use Simplex LP as the solving method to find a global optimal solution. Save the Solver model below the Maximum weekly profit model label. Solve the model, keeping the Solver solution. Table 3: Solver Constraints Constraint Cell or Range Each webinar is scheduled at least once on Tuesday and once on Thursday B4:F5 Each Tuesday and Thursday…arrow_forward
- I want to ask someone who has experiences in writing physics based simulation software. For context I am building a game engine, and want to implement physics simulation. There are a few approaches that I managed to find, but would like to know what are other approaches to doing physics simulation entry points from scenes, would you be able to visually draw me a few approaches (like 3 approaces)? When I say entry point to the actual physics simulation. An example of this is when the user presses the play button in the editor, it starts and initiates the physics system. Applying all of the global physics settings parameters that gets applied to that scene. Here is the use-case, I am looking for. If you have two scenes, and select scene 1. You press the play button. The physics simulation starts. When that physics simulation starts, you are also having to update the physics through some physics dedicated delta time because physics needs to happen faster update frequency. To elaborate,…arrow_forwardI want to ask someone who has experiences in writing physics based simulation software. For context I am building a game engine, and want to implement physics simulation. There are a few approaches that I managed to find, but would like to know what are other approaches to doing physics simulation entry points from scenes, would you be able to visually draw me a few approaches (like 3 approaces)?When I say entry point to the actual physics simulation. An example of this is when the user presses the play button in the editor, it starts and initiates the physics system. Applying all of the global physics settings parameters that gets applied to that scene.Here is the use-case, I am looking for. If you have two scenes, and select scene 1. You press the play button. The physics simulation starts. When that physics simulation starts, you are also having to update the physics through some physics dedicated delta time because physics needs to happen faster update frequency.To elaborate, what…arrow_forwardMale comedians were typically the main/dominant star of television sitcoms made during the FCC licensing freeze. Question 19 options: True False In the episode of The Honeymooners that you watched this week, why did Alice decide to get a job outside of the home? Question 1 options: to earn enough money to buy a mink coat to have something to do while the kids were at school to pay the bills after her husband got laid offarrow_forward
- After the FCC licensing freeze was lifted, sitcoms featuring urban settings and working class characters became far less common. Question 14 options: True Falsearrow_forwardsolve this questions for me .arrow_forwarda) first player is the minimizing player. What move should be chosen?b) What nodes would not need to be examined using the alpha-beta pruning procedure?arrow_forward
- Consider the problem of finding a path in the grid shown below from the position S to theposition G. The agent can move on the grid horizontally and vertically, one square at atime (each step has a cost of one). No step may be made into a forbidden crossed area. Inthe case of ties, break it using up, left, right, and down.(a) Draw the search tree in a greedy search. Manhattan distance should be used as theheuristic function. That is, h(n) for any node n is the Manhattan distance from nto G. The Manhattan distance between two points is the distance in the x-directionplus the distance in the y-direction. It corresponds to the distance traveled along citystreets arranged in a grid. For example, the Manhattan distance between G and S is4. What is the path that is found by the greedy search?(b) Draw the search tree in an A∗search. Manhattan distance should be used as thearrow_forwardwhats for dinner? pleasearrow_forwardConsider the follow program that prints a page number on the left or right side of a page. Define and use a new function, isEven, that returns a Boolean to make the condition in the if statement easier to understand. ef main() : page = int(input("Enter page number: ")) if page % 2 == 0 : print(page) else : print("%60d" % page) main()arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning




