subject
Computers and Technology, 09.07.2020 01:01 3mina

In this exercise, you will write a class that models a band booster and use your class to update sales of band candy. 1. Write the BandBooster class assuming a band booster object is described by two pieces of instance data: name (a String) and boxesSold (an integer that represents the number of boxes of band candy the booster has sold in the band fundraiser). The class should have the following methods:
• A constructor that has one parameter—a String containing the name of the band booster. The constructor should set boxesSold to 0.
• A method getName that returns the name of the band booster (it has no parameters).
• A method updateSales that takes a single integer parameter representing the number of additional boxes of candy sold. The method should add this number to boxesSold.
• A toString method that returns a string containing the name of the band booster and the number of boxes of candy sold in a format similar to the following:
Joe: 16 boxes
2. Write a program that uses BandBooster objects to track the sales of 2 band boosters over 3 weeks.
Your program should do the following:
• Read in the names of the two band boosters and construct an object for each.
• Prompt for and read in the number of boxes sold by each booster for each of the three weeks.
Your prompts should include the booster’s name as stored in the BandBooster object. For
example,
Enter the number of boxes sold by Joe this week:
• For each member, after reading in the weekly sales, invoke the updateSales method to update the total sales by that member.
• After reading the data, print the name and total sales for each member (you will implicitly use the toString method here).

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, willwhitlock803
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
image
Computers and Technology, 22.06.2019 15:00, mitchellk872
Which of the following statements tests if students have a grade of 70 or above, as well as fewer than five absences? a: if(grade > = 70 and daysabsent < = 5): b: if(grade > = 70 or daysabsent < = 5): c: if(grade > 70 and daysabsent < = 5): d: if(grade > 70 or daysabsent < = 5): i took the test the answer is a
Answers: 1
image
Computers and Technology, 23.06.2019 11:00, jolleyrancher78
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
image
Computers and Technology, 24.06.2019 12:00, yagalneedshelp8338
Match the function to its purpose. fast worth 50pts.
Answers: 1
You know the right answer?
In this exercise, you will write a class that models a band booster and use your class to update sal...

Questions in other subjects:

Konu
Mathematics, 17.09.2019 15:30
Konu
Mathematics, 17.09.2019 15:30
Konu
Mathematics, 17.09.2019 15:30
Konu
History, 17.09.2019 15:30