
Explanation of Solution
a.
Method heading for each method:
- The method heading is “public void sellTickets(int number)” that takes a parameter “number” of integer type and update the number of tickets sold and total sales.
- The method heading is “public void phoneSalesOver()” that takes no parameters and sales can be made at the venue only...
Explanation of Solution
b.
Preconditions and postconditions of each method:
- Precondition and postcondition of “public void sellTickets(int number)” method.
- Precondition: checks whether the input is positive and less than or equal to number of unsold tickets.
- Postcondition: update the number of tickets sold and total sales.
- Precondition and postcondition of “public void phoneSalesOver()” method.
- Precondition: None.
- Postcondition: This method is used to sell the tickets only at the venue.
- Precondition and postcondition of “public int getTicketsSold()” method...
Explanation of Solution
c.
Test class for some Java statement:
//Create an object for ConcertPromoter
ConcertPromoter con = new ConcertPromoter();
//Call initialize () method
con.initialize("The Ducks", 100, 10.00, 12.00);
//Display the header message
System.out.println("Concert Promoter Sales
//Create an object for Scanner class
Scanner reader = new Scanner(System.in);
//Declare and initialize the flag variable
boolean done = false;
//Loop executes until the true
while (!done)
{
/*Call phoneSalesOnly() method to check whether sales through phone. */
if (con.phoneSalesOnly())
//Display the Sales details
System.out.println("Sell tickets (S), Change to venue sales (V), Finish selling (F)");
/*Otherwise, display the modified sales details. */
else
System.out.println("Sell tickets (S), Finish selling (F)");
//Read the input from user
String response = reader.next();
//Check whether the input is equal to "F"
if (response...
Explanation of Solution
d.
Implementation of class:
ConcertPromoter.java:
//Import the java package
import java.util.Scanner;
//Define the class
public class ConcertPromoter
{
//Declare the required variables
private String bandName;
private int capacity;
private int ticketsSold;
private double costPhone;
private double costVenue;
private double totalSales;
private boolean salesAreByPhone;
//Define the sellTickets() method
public void sellTickets(int number)
{
/*Check whether the number is inbetween "0" and ticket left. */
if (number > 0 && number <= getTicketsLeft())
{
//Add the ticket sold number
ticketsSold += number;
/*Call getSaleCost() method to calculate the total sales...
Explanation of Solution
e.
List of extra methods and attributes needed for this implementation:
There is no extra attributes are needed for this implementation.
The extra methods that were used apart from the mentioned methods are,
- public void initialize() method:
- This method is used to initialize the declared variables.
- public boolean phoneSalesOnly() method:
- This method is used to return the true when user making sales through the phone. Otherwise, return false.
- public String getSalesReport() method:
- This method is used to return the sales report of sold tickets count and their amount...
Explanation of Solution
f.
Implementation of class:
ConcertPromoter.java:
//Import the java package
import java.util.Scanner;
//Define the class
public class ConcertPromoter
{
//Declare the required variables
private String bandName;
private int capacity;
private int ticketsSold;
private double costPhone;
private double costVenue;
private double totalSales;
private boolean salesAreByPhone;
//Define the initialize() method
public void initialize(String band, int max, double costOverPhone, double costAtVenue)
{
//Initialize the declared variables
bandName = band;
capacity = max;
ticketsSold = 0;
costPhone = costOverPhone;
costVenue = costAtVenue;
totalSales = 0.0;
salesAreByPhone = true;
}
//Define the doTicketSale() method
public void doTicketSale()
{
//Read the maximum ticket to sell from user
System.out.println("How many tickets to sell? (Maximum " + getTicketsLeft() + ")");
Scanner reader = new Scanner(System.in);
int toSell = reader.nextInt();
//Call sellTickets() method to initialize the flag
boolean saleCompleted = sellTickets(toSell);
//Check whether the flag is "true"
if (saleCompleted)
/*Call getSaleCost() method to calculate the ticket cost and then display it. */
System.out.println("The cost of the tickets is " + getSaleCost(toSell));
//Otherwise, display the error message
else
System.out.println("Sorry, unable to complete that sale");
}
//Define the sellTickets() method
public boolean sellTickets(int number)
{
/*Check whether the number is in between "0" and ticket left. */
if (number > 0 && number <= getTicketsLeft())
{
//Add the ticket sold count
ticketsSold += number;
/*Call getSaleCost() method to calculate the total sales. */
totalSales += getSaleCost(number);
//Return the true
return true;
}
//Otherwise, return the false
else
return false;
}
//Define the getSaleCost() method
public double getSaleCost(int number)
{
//Declare the variable
double saleCost = number;
//Check whether sales by phone is "true"
if (salesAreByPhone)
//Calculate the sale cost with cost phone
saleCost *= costPhone;
/*Otherwise, calculate the sale cost with cost venue. */
else
saleCost *= costVenue;
//Return the sale cost
return saleCost;
}
//Define the phoneSalesOver() method
public void phoneSalesOver()
{
//Set the flag as "false"
salesAreByPhone = false;
}
//Define the getTicketsSold() method
public int getTicketsSold()
{
//Return the ticket sold
return ticketsSold;
}
//Define the getTicketsLeft() method
public int getTicketsLeft()
{
//Return the remaining ticket
return capacity - ticketsSold;
}
//Define the getTotalSales() method
public double getTotalSales()
{
//Return the total sales
return totalSales;
}
//Define the phoneSalesOnly() method
public boolean phoneSalesOnly()
{
//Return the phone sales
return salesAreByPhone;
}
//Define the getSalesReport() method
public String getSalesReport()
{
//Return the sales report
return "Sales for " + bandName + ": Tickets sold: " + ticketsSold + " for " + totalSales;
}
//Define the main() method
public static void main(String[] args)
{
//Create an object for ConcertPromoter
ConcertPromoter con = new ConcertPromoter();
//Call initialize () method
con...
Want to see the full answer?
Check out a sample textbook solution
Chapter 5 Solutions
Java: An Introduction to Problem Solving and Programming plus MyProgrammingLab with Pearson eText -- Access Card Package (7th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Mechanics of Materials (10th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Electric Circuits. (11th Edition)
- b) 12. Consider XeO a) Draw the correct Lewis structure for this molecule. Calculate the steric number for XeO3 and based on your answer, what would be the molecular geometry it adopts? d) c) (1mark) According to VB theory, what is the hybridization for this molecule? Use the space below to explicitly show how you have arrived to your answer in part c. Clearly Sketch how hybridization occurs using electron orbital box diagrams and link central and terminal atoms.arrow_forwardConsider CIFs and draw it's Lewis structure. What molecular geometry would you expect it 10. to have, and why? Comment on the distortion of the bond angles, if any is expected.arrow_forwardX Course Home P Pearson+ x + pearson.com/courses/13810469/menu/a2c41aca-b4d9-4809-ac2e-eef29897ce04 A Learning Goal: To understand the components and processes of a galvanic cell. A galvanic cell (or voltaic cell) produces electricity using a spontaneous redox reaction, such as the one shown here: Sn(s) + Cu (aq) Sn(aq) + Cue) The components of this reaction are separated by a salt bridge and connected with a wire forcing the electrons to travel across the wire, creating electricity Correct Previous Answers Standard reduction potentials for tin(II) and copper(II) The standard reduction potential for a substance indicates bow readily that substance gains electrons relative to other substances at standard conditions! Consider the following: Sn(aq) + 2e Sn(s). Cu(aq) + 2eCu(s), E red 0.140 V E red +0.337 V Sn Cu salt bridge Part B Sn²+(aq) Cu (ac The salt bridge is a U-shaped glass tube that is filled with a gel-like substance containing a salt. The salt bridge completes the circuit and…arrow_forward
- 11. Consider IOF3, a) Draw optimized Lewis structures for possible isomers of IOFs. For each isomer, include all equivalent resonance contributors (if applicable) and all lone pairs and all non-zero formal charges Which isomer do you think is most likely? Why?arrow_forwardx1+ 4809-ac2e-eef29897ce04 4 Part A A For a protein of 100 residues, estimate the entropy change per mole upon denaturation. Express your answer with the appropriate units. ΜΑ 0 ? X-10 хы J AS Value mol K ! You have already submilled this answer. Enter a new answer Noloredit lost Try again Submit Previous Answers Request Answer Part B Complete previous panis Part C Complete previous part(s) Braude Eneback Next > 5:08 PM 10/20/2025arrow_forwardPart B Correct glucose +P G6P + H2O AG 13.8 kJ/mol [G6PH₂O] Kea glucose P ΔΟΜ e Note: in the biochemical standard state, the activity of H2O is assigned a value of 1 G6P (1) (0.005) (0.005) e 00831x310 G6P 0.000025 xe 36 1.2 107 M This very low concentration of the desired product would be unfavorable for glycolysis In fact, the reaction is coupled to ATP hydrolysis to give the overall reaction ATP glucose What is AG for the coupled reaction? glucose-6-phosphate Express your answer to three significant figures and include the appropriate units, AG= Value kJ mol Submit Previous Answers Request Answer ADP Harrow_forward
- explain in detail thank youarrow_forwardUse a simple exponential smoothing Method to forecast one-quarter-ahead revenues for Home Depot. Refer to the Home Depot Quarterly.xlsx dataset Year and Quarter Homedepot sales 19811 8.010999978 19812 10.60699999 19813 13.71499997 19814 19.20899999 19821 25.60999996 19822 33.06299996 19823 28.727 19824 30.24599999 19831 42.99299991 19832 66.61299992 19833 64.08299995 19834 82.49499989 19841 95.87199998 19842 119.0679998 19843 100.4589999 19844 117.3799999 19851 145.0479999 19852 174.2389998 19853 177.7179999 19854 203.724 19861 222.619 19862 263.4329996 19863 251.5369997 19864 273.8729992 19871 333.9689999 19872 381.4429998 19873 364.2449999 19874 374 19881 446.5919991 19882 518.1589985 19883 509.9899998 19884 524.7729988 19891 641.5209999 19892 704.0249996 19893 699.7399998 19894 713.2489986 19901 880.855999 19902 990.3459988 19903 936.6119995 19904 1007.542 19911 1186.889999 19912 1352.792 19913…arrow_forwardWrite the set of SQL commands necessary to insert the data into the INVOICE table you created in Problem 17, as illustrated in Figure P8.16.arrow_forward
- Refer to the shampoo_sales.xlsx time-series dataset. This data shows sales of shampoo over three years monthly. Carry out simple exponential smoothing and Holt's Trend-Corrected on this data and determine whether the data shows any trend. Assume the initial value for the level smoothing parameter (alpha) and Trend smoothing parameter (gamma) is 0.5 Month Sales of shampoo over a three year period 1-Jan 266 1-Feb 145.9 1-Mar 183.1 1-Apr 119.3 1-May 180.3 1-Jun 168.5 1-Jul 231.8 1-Aug 224.5 1-Sep 192.8 1-Oct 122.9 1-Nov 336.5 1-Dec 185.9 2-Jan 194.3 2-Feb 149.5 2-Mar 210.1 2-Apr 273.3 2-May 191.4 2-Jun 287 2-Jul 226 2-Aug 303.6 2-Sep 289.9 2-Oct 421.6 2-Nov 264.5 2-Dec 342.3 3-Jan 339.7 3-Feb 440.4 3-Mar 315.9 3-Apr 439.3 3-May 401.3 3-Jun 437.4 3-Jul 575.5 3-Aug 407.6 3-Sep 682 3-Oct 475.3 3-Nov 581.3 3-Dec 646.9arrow_forwarddy Car x Mail Kare x Golden Ge × University x Course Cn x Essential ( x A Content/ x Smartworx Essential C ncia.wwnorton.com/274325 r 3: Problem Set Due Date: 10/15/25 This is a Multiple Choice question/It is worth 1 point/You have 1 of 2 attempts remaining/There is a 1% attempt penalty 17 Question (1 point) ✓ 2nd attempt ☆ Σ entok9826@uapb For the reaction ATP + H2O ADP + P, the AG -30.5 kJ/mol. What would be the associated equilibrium constant for this reaction? Choose one: O A. 35,000 O B. 135,000 © C. 3500 O D. 235,000 > 1st attempt M D . O Oct 13arrow_forwardWE ARE HIRING! HyphenX SALESFORCE DEVELOPER Exp - 0 - 2.5 years SEND YOUR CV: hr.ops@hyphenxsolutions.comarrow_forward
Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK 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 Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage




