Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 9, Problem 10E
- Write a
program named DemoJobs for Harold’s Home Services. The program should instantiate several Job objects and demonstrate their methods. The Job class contains four data fields—description (for example, "wash windows"), time in hours to complete (for example, 3.5), per-hour rate charged (for example, $25.00), and total fee (hourly rate times hours). Include properties to get and set each field except the total fee—that field will be read-only, and its value is calculated each time either the hourly fee or the number of hours is set. Overload the + operator so that two Jobs can be added. The sum of two Jobs is a new Job containing the descriptions of both original Jobs (joined by and), the sum of the time in hours for the original Jobs, and the average of the hourly rate for the original Jobs. - Harold has realized that his method for computing the fee for combined jobs is not fair. For example, consider the following:
• His fee for painting a house is $100 per hour. If a job takes 10 hours, he earns $1000.
• His fee for dog walking is $10 per hour. If a job takes 1 hour, he earns $10.
• If he combines the two jobs and works a total of 11 hours, he earns only the average rate of $55 per hour, or $605.
Devise an improved, weighted method for calculating Harold’s fees for combined Jobs and include it in the overloaded operator+() method. Write a program named DemoJobs2 that demonstrates all the methods in the class work correctly.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
This has to be done in visual studio, c# windows form application (.net fromework).
Question:
The application should be able to do the following :• Create a class called Person which contains 4 private fields : Name(string), Surname (string),Course(string), CRNumber(int).• The class must contain 4 public properties which will be used to get and set the values of the private fields.• The class must contain a default constructer. The class must also contain an overloaded constructer which should be able to set the values of each of the private fields.• The class must contain a static ViewInfo method which will be used to display information of a queue of person objects back to the user neatly grouped underneath each other as displayed above.• Once a user clicks on the “Add Person” button then the information in the respective textboxes should be used to create a Person object (using the properties or the overloaded constructor) and add it to a queue which is of type Person. The…
Create an application named JobDemo that declares and uses Job objects. The Job class holds job information for a home repair service. The class has five properties that include a job number, customer name, job description, estimated hours, and price for the job. Create a constructor that requires parameters for all the data except price. Include auto-implemented properties for the job number, customer name, and job description, but not for hours or price; the price field value is calculated as estimated hours times $45.00 whenever the hours value is set. Also create the following for the class: •An Equals() method that determines two Jobs are equal if they have the same job number •A GetHashCode() method that returns the job number •A ToString() method thatreturns a string containing all job information The JobDemo application declares a few Job objects, sets their values, and demonstrates that all the methods work as expected. b.Using the Job class you created in Exercise 3a, write a…
In 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.
Chapter 9 Solutions
Microsoft Visual C#
Ch. 9 - Assume that you have created a class named...Ch. 9 - Prob. 9RQCh. 9 - Assume that you have created a class named...Ch. 9 - Create an application named SalesTransactionDemo...Ch. 9 - Create an application named CarDemo that declares...Ch. 9 - Create a program named SalesTaxDemo that declares...Ch. 9 - Prob. 8ECh. 9 - Write a program named DemoJobs for Harolds Home...Ch. 9 - a. Write a FractionDemo program that instantiates...Ch. 9 - Prob. 1DE
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Don't put incorrect code..arrow_forwardStatic & Not Final Field: Accessed by every object, Changing Non-Static & Final Field: Accessed by object itself, Non-Changing Static & Final: Accessed by every object, Non-Changing Non-Static & Not Final Field: Accessed by object itself, ChangingRead the following situation and decide how the variables should be defined. You have a class named HeartsPlayerA round of Hearts starts with every player having 13 cardsPlayers then choose 3 cards to “trade” with a player (1st you pass left, 2nd you pass right, 3rd you pass across, 4th you keep)Players then strategically play cards in order to have the lowest scoreAt the end of the round, points are cumulatively totaled for each player.If one player’s total is greater than 100, the game ends and the player with the lowest score wins. 1. How should the following data fields be defined (with respect to final and static)?(a) playerPosition (These have values of North, South, East, or West)(b) directionOfPassing(c) totalScore…arrow_forwardPlease help wih the following .Net C# applicationarrow_forward
- Please use C#!arrow_forwardHow do I create this class in Java? Contact Class Requirements The contact object shall have a required unique contact ID string that cannot be longer than 10 characters. The contact ID shall not be null and shall not be updatable. The contact object shall have a required firstName String field that cannot be longer than 10 characters. The firstName field shall not be null. The contact object shall have a required lastName String field that cannot be longer than 10 characters. The lastName field shall not be null. The contact object shall have a required phone String field that must be exactly 10 digits. The phone field shall not be null. The contact object shall have a required address field that must be no longer than 30 characters. The address field shall not be null.arrow_forwardIn C#, a program that implements and uses a class called MyRectangle. Data items should include: length, width, color, and label. Define properties with appropriate accessor functions for each of the data items. Methods should include a default constructor that sets values to the empty string or zero, a constructor that allows the user to specify all values for the data items, a member method that computes and returns the area of the shape, and a member method called DisplayShape that outputs all the information (including the area via the ComputeArea method for the given rectangle in a reasonable format. Sample output belowarrow_forward
- javaarrow_forwardWrite the application AutomobileDemo that prompts a user for data for eight Automobile objects. The Automobile class includes the following auto-implemented properties: IdNumber - The ID number (an int) Make - The make (a string) Year - The year (an int) Price - The price (a double) Override the ToString() method to return all the details for an Automobile. During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown): Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.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…arrow_forwardWrite the application AutomobileDemo that prompts a user for data for eight Automobile objects in C# language The Automobile class includes the following auto-implemented properties: IdNumber - The ID number (an int) Make - The make (a string) Year - The year (an int) Price - The price (a double) Override the ToString() method to return all the details for an Automobile. During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown): Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.00arrow_forward
- Create a class named Ship that has two private fields one for the name (string)of the ship, and the other for the year (string) the ship was built. The classcontains a parameterized constructor to set the values of each field get methods for each of the fields display method to display ship’s information.Create a class named CruiseShip that extends Ship class. CruiseShip class should have a private field for the maximum number of passengers (int).The class contains- a parameterized constructor to set the value of the field- get and set method for the field- a display method that overrides ship class display method anddisplay CruiseShip information.Create an application/class named CruiseShipDemo that allows a user toenter values to create 5 CruiseShip objects and save them in the array. Display the records.The CruiseShipDemo class should have a method named update to updatethe CruiseShips information. The method prompts the user for the ship name, if the requested record does not…arrow_forwardCreate a Student class that have two data members id (assign to your ID) and name (assign to your name). Create the object of the Student class by new keyword and printing the objects value. You may name your object as Student1. The output should be like this: 20170500 Asma Zubaidaarrow_forwardWrite a class named RetailItem that holds data about an item in a retail store. The class should have the following properties:• Description—The Description property should hold a brief description of the item.• UnitsOnHand—The UnitsOnHand property should hold the number of units currently in inventory.• Price—The Price property should hold the item’s retail price. Write a constructor that accepts arguments for each property.The application should create an array of three RetailItem objects containing the following data: Description Units on Hand PriceItem 1 Jacket 12 59.95Item 2 Jeans 40 34.95Item 3 Shirt 20 24.95The application should have a loop that steps through the array, displaying each element’s properties.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY