In previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics:
• The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing Dancing, Musical instrument, and Other.
• The class contains an auto-implemented property that holds a contestant’s name.
• The class contains fields for a talent code and description. The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for Invalid. The talent description is a read-only property that is assigned a value when the code is set.
Modify the GreenvilleRevenue
• The program prompts the user for the number of contestants in this year’s competition; the number must be between 0 and 30. The program continues to prompt the user until a valid value is entered.
• The expected revenue is calculated and displayed. The revenue is $25 per contestant.
• The program prompts the user for names and talent codes for each contestant entered. Along with the prompt for a talent code, display a list of the valid categories.
• After data entry is complete, the program displays the valid talent categories and then continuously prompts the user for talent codes and displays the names of all contestants in the category. Appropriate messages are displayed if the entered code is not a character or a valid code.
Trending nowThis is a popular solution!
Chapter 9 Solutions
Microsoft Visual C#
- Create a program named FriendList that declares an array of eight Friend objects and prompts the user to enter data about the friends. Display the Friend objects in alphabetical order by first name. The Friend class includes auto- implemented properties for the Friend’s name, phone number, and three integers that together represent the Friend’s birthday—month, day, and year. 9. b. Create a FriendBirthday program that modifies the FriendList program created in Exercise 9a so that after the list of Friend objects is displayed, the program prompts the user for a specific Friend’s name and the program returns the Friend’s phone number and birthday. Display an appropriate message if the friend requested by the user is not found. 9. c. Create a program named AllFriendsInSameMonth that modifies the program in Exercise 9b so that after the requested Friend’s birthday is displayed, the program also displays a list of every Friend who has a birthday in the same month. C#…arrow_forwardIn previous chapters, you have created programs for the Greenville Idol competition. Now add a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing, Dancing, Musical instrument, and Other. Name these fields talentCodes and talentStrings respectively. The class contains an auto-implemented property Name that holds a contestant’s name. The class contains fields for a talent code (talentCode) and description (talent). The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for Invalid. The talent description is a read-only property that is assigned a value when the code is set. 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…arrow_forwardPlease help me with this problem. Create a class to represent an Airplane object containing instances of the Passenger objects Airplane passengers : Passenger [ ] airplaneName : String numPassengers : int //calculated controlled variable no setter Airplane() //default array length = 100 , numPassengers = 0 Airplane(String) //default array length = 100 , numPassengers = 0 Airplane(int) //max size of array, if value is negative set to 0 Airplane(String, int) //name of airplane, max size of array, if value is negative set to 0 addPassenger(Passenger) : void getAirplaneName() : String getPassenger(int) : Passenger //return null if index is invalid getNumPassengers() : int //notice no setter… this is a controlled variable getFirstPassenger() : Passenger getLastPassenger() : Passenger getPassengers() : Passenger [ ] setAirplaneName(String) : void printAllDetails() : void // prints Airplane attributes Passenger attributes as formatted below: // "AirplaneName: %20s | Number of Passengers:…arrow_forward
- Create a class Student with following data members, name, roll, and marks as private data member. Create array of objects for three students, compare their marks but make sure allocating memory to all the objects during run time only and display the records of the student who is getting highest score.arrow_forwardComplete the Course class by implementing the courseSize() method, which returns the total number of students in the course. Given classes: Class LabProgram contains the main method for testing the program. Class Course represents a course, which contains an ArrayList of Student objects as a course roster. (Type your code in here.) Class Student represents a classroom student, which has three fields: first name, last name, and GPA. Ex. For the following students: Henry Bendel 3.6 Johnny Min 2.9 the output is: Course size: 2 public class LabProgram { public static void main (String [] args) { Course course = new Course(); // Example students for testing course.addStudent(new Student("Henry", "Bendel", 3.6)); course.addStudent(new Student("Johnny", "Min", 2.9)); System.out.println("Course size: " + course.courseSize()); } } public class Student { private String first; // first name private String last; // last name private…arrow_forwardCreate a Vector2D class with properties x and y and a proper constructor method. Plus, minus and multiplication with a scalar operators should be overloaded. Create a Body class with properties of pos, vel, mass and constructor(float Mass, Vector2D Pos, Vector2D Vel), addForce(Vector2D F) and Move(float dt) methods. Your program should create an array or collection of Bodies, at each time step (dt), calculate forces that bodies exert each other and apply accordingly. Finally, in a 2D space, bodies should move freely based on their properties and applied forces. You can use option buttons or another element to represent bodies and move them inside the form.arrow_forward
- Excercise: Listed next is the skeleton for a class named City. Each city has a name and temperature: public class City { private String cityName; private int temperature; } Flesh out the class with appropriate accessors, constructors, and mutators. Next, modify the class so that it implements the Comparable interface. The order between instances of the City class depends on the temperature. Test your class by creating an array of sample cities and sort them in an ascending order using Arrays.sort Notes: The language used for this question is Java. So far, this is the City class after fleshing it out: public class City implements Comparable<City> {private String cityName;private double temperature; public City() {} public City(String cityName, double temperature) {this.cityName = cityName;this.temperature = temperature;} public String getCityName() {return cityName;} public double getTemperature() {return temperature;} public void setName(String cityName)…arrow_forwardWrite in c++ language: Your program will have a class called FlightController that is going to be derived from twobase classes which are called LaunchController and LandingController. The FlightControllerclass inherits all accessible data fields and methods from the LandingController andLaunchController classes.Inside the FlightController class, you will define an object of type FlightSchedule which willcontain an array of 3 objects of type Flight. In your Flight objects, the constructor of theseobjects will ask from the user for the inputs of: flight name, launch hour, launch minutes,flight duration. The value of state of the Flight object will be assigned to “Idle” as a defaultvalue in the constructor also and you will call the member function within the Flight classwhich will calculate the landing time for your flight object by using the duration and thelaunch time. Definition of Flight class will also contain the necessary getters and setters thatare given in the diagram and needed…arrow_forwardUsing the Automobile class you created Chapter 10, Programming Exercise 5A as a base, derive a FinancedAutomobile class that contains all the data of an Automobile, plus the following field: AmtFinanced - The amount financed (a double) Override the parent class ToString() method to include the child class’s additional data. Create a program named AutomobileDemo2 that contains an array of four FinancedAutomobile objects. Prompt the user for all the necessary data, and do not allow duplicate ID numbers and do not allow the amount financed to be greater than the price of the automobile. Sort all the records in ID number order and display them with a total price for all FinancedAutomobiles and a total amount financed. For example, the output should be in the following format: Summary: FinancedAutomobile 1 2017 Honda Price is $26,000.00 Amount financed $12,000.00 FinancedAutomobile 4 2019 Honda Price is $36,000.00 Amount financed $0.00 FinancedAutomobile 5 2016 Toyota Price is $30,000.00…arrow_forward
- Using the Automobile class you created Chapter 10, Programming Exercise 5A as a base, derive a FinancedAutomobile class that contains all the data of an Automobile, plus the following field: AmtFinanced - The amount financed (a double) Override the parent class ToString() method to include the child class’s additional data. Create a program named AutomobileDemo2 that contains an array of four FinancedAutomobile objects. Prompt the user for all the necessary data, and do not allow duplicate ID numbers, and do not allow the amount financed to be greater than the price of the automobile. Sort all the records in ID number order and display them with a total price for all FinancedAutomobiles and a total amount financed. For example, the output should be in the following format:arrow_forwardIn C#, Create a program named ConferencesDemo for a hotel that hosts business conferences. Allows a user to enter data about five Conference objects and then displays them in order of attendance from smallest to largest. The Conference class contains fields for the following: group - The group name (as a string) date - The starting date (as a string) attendees - The number of attendees (as an int) Include properties for each field. Also, include an IComparable.CompareTo() method so that Conference objects can be sorted in order from least to greatest attendees.arrow_forwardUsing the attached diceType, create a class rollType that holds information for a roll of several dice simultaneously. rollType should contain the number of dice being rolled and a pointer to a dynamic array of diceType. (2) Create a client program to test your implementation that creates a dice roll whose size is based on the user's input. Step 1: Define remaining member functions Step 2: Complete test program Notes: DO NOT modify anything in diceType.h or diceTypeImp.cpp. **I just need your best guess at filling in the stub functions for this assignment and an updated test file. It doesn't have to be all that correct. I've attached the two diceType files as images. Only the rollDice ones need altering.** //diceRollType header file #ifndef DICE_ROLL_TYPE_H#define DICE_ROLL_TYPE_H #include "diceType.h" class diceRollType {public:void getResults() const;void rollDice() const; diceRollType(int = 1);~diceRollType();diceRollType(const diceRollType &otherDice); private:diceType…arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage