Starting out with Visual C# (4th Edition)
4th Edition
ISBN: 9780134382609
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 9, Problem 2AW
Write the accessors for a property named CustomerNumber that assigns a string value to the _customerNumber field.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write the property procedures for a property named CustomerNumber that assigns a string value to a member variable named strCustomerNumber
It is possible for the same property to have both a main key and an alternative key.
Write 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.
Chapter 9 Solutions
Starting out with Visual C# (4th Edition)
Ch. 9.1 - How is a class like a blueprint?Ch. 9.1 - Briefly describe the process of writing a class...Ch. 9.1 - What is a constructor?Ch. 9.1 - Prob. 9.4CPCh. 9.1 - When you pass an object that is an instance of a...Ch. 9.2 - What is a property?Ch. 9.2 - Prob. 9.7CPCh. 9.2 - Prob. 9.8CPCh. 9.2 - Prob. 9.9CPCh. 9.2 - Prob. 9.10CP
Ch. 9.3 - What is a parameterized constructor?Ch. 9.3 - Prob. 9.12CPCh. 9.3 - Prob. 9.13CPCh. 9.3 - What happens if you write a class with no...Ch. 9.3 - Describe the purpose of the default constructor.Ch. 9.4 - Prob. 9.16CPCh. 9.4 - How can you initialize an array of a class type...Ch. 9.4 - Prob. 9.18CPCh. 9.5 - Prob. 9.19CPCh. 9.5 - When designing an object-oriented application, who...Ch. 9.5 - How do you identify the potential classes in a...Ch. 9.5 - What are a classs responsibilities?Ch. 9.5 - What two questions should you ask to determine a...Ch. 9.5 - Will all a class's actions always be directly...Ch. 9.6 - Prob. 9.25CPCh. 9.6 - Prob. 9.26CPCh. 9.6 - Prob. 9.27CPCh. 9.6 - Prob. 9.28CPCh. 9.6 - Prob. 9.29CPCh. 9 - Each object that is created from a class is called...Ch. 9 - Prob. 2MCCh. 9 - The first line of a class declaration is known as...Ch. 9 - The classs________ are the statements that define...Ch. 9 - A(n) _____ is a method that is automatically...Ch. 9 - A(n) is a special type of class member that allows...Ch. 9 - A special set of methods, known as_________, work...Ch. 9 - Prob. 8MCCh. 9 - The parameter of the set accessor is automatically...Ch. 9 - A can be read, but it cannot be modified. a....Ch. 9 - When the value of an item is dependent on other...Ch. 9 - A constructor that accepts arguments is known as...Ch. 9 - Prob. 13MCCh. 9 - Prob. 14MCCh. 9 - A methods ______ consists of the methods name and...Ch. 9 - A is a constructor that accepts no arguments. a....Ch. 9 - If you write a class with no constructor...Ch. 9 - Prob. 18MCCh. 9 - A classs responsibilities are_______. a. the...Ch. 9 - Prob. 20MCCh. 9 - Objects that are instances of a class are always...Ch. 9 - Prob. 2TFCh. 9 - A class is an object.Ch. 9 - It is a common practice to make all a classs...Ch. 9 - The same rules for naming variables apply to...Ch. 9 - If you need to make a property read only, you...Ch. 9 - If you try to pass a property to a ref or an out...Ch. 9 - Class fields are almost always declared public in...Ch. 9 - The get accessor can be thought of as a method...Ch. 9 - Constructors can accept arguments in the same way...Ch. 9 - It is legal to write a class without any...Ch. 9 - Objects that are instances of a class can be...Ch. 9 - Prob. 13TFCh. 9 - One way to find the classes needed for an...Ch. 9 - Prob. 15TFCh. 9 - By default, a controls Modifiers property is set...Ch. 9 - Prob. 1SACh. 9 - What are the advantages of storing classes in...Ch. 9 - How is a constructor used?Ch. 9 - What is the difference between a class and an...Ch. 9 - What convention do most programmers follow when...Ch. 9 - What is the value parameter? How is it created?Ch. 9 - What is executed any time a class property is...Ch. 9 - What is executed any rime a value is assigned to a...Ch. 9 - How can you protect class fields from accidental...Ch. 9 - Prob. 10SACh. 9 - Is it possible to pass initialization values to...Ch. 9 - How does the compiler distinguish a method from...Ch. 9 - What do you call the constructor that is provided...Ch. 9 - Prob. 14SACh. 9 - Prob. 15SACh. 9 - Prob. 16SACh. 9 - Prob. 17SACh. 9 - Write a statement that creates an instance of the...Ch. 9 - Write the accessors for a property named...Ch. 9 - Prob. 3AWCh. 9 - Look at the following description of a problem...Ch. 9 - Pet Class Create a class named Pet (similar to the...Ch. 9 - Car Class Create a class named Car that has the...Ch. 9 - Personal Information Class Create a class that...Ch. 9 - Employee Class Write a class named Employee that...Ch. 9 - RetailItem Class Write a class named RetailItem...Ch. 9 - Dorm and Meal Plan Calculator A university has the...Ch. 9 - E-Mail Address Book Create an application with a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Dice Game Write a program that uses the Die class that was presented in this chapter to play a simple dice game...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Age Classifier Write a program that asks the user to enter a persons age The program should display a message i...
Starting Out with Python (3rd Edition)
Let a and b denote object modules or static libraries in the current directory, and let a b denote that a depen...
Computer Systems: A Programmer's Perspective (3rd Edition)
Each repetition of a loop is known as a(n) _________.
Starting Out with C++: Early Objects (9th Edition)
(Bar-Chart Printing Program) One interesting application of computers is to display graphs and bar charts. Writ...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
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
- The employee structure variable contains a member variable named decSalary. Which of the following increases the employee’s salary by 10%?a. employee.decSalary = employee.decSalary * .1b. employee.decSalary = employee.decSalary * 1.1c. employee.decSalary *= .1d. both a and carrow_forwardLook at the following description of a problem domain: A doctor sees patients in her practice. When a patient comes to the practice, the doctor performs one or more procedures on the patient. Each procedure performed has a description and a standard fee. As patients leave, they receive a statement that shows their name and address, as well as the procedures that were performed, and the total charge for the procedures.Assume that you are creating an application to generate a statement that can be printed and given to the patient.A) Identify all of the potential classes in this problem domain.B) Refine the list to include only the necessary class or classes for this problem.C) Identify the responsibilities of the class or classes that you identified in step B.arrow_forwardThis is the default value for fields declared to "hold" object instances. Such indicates that the variable does not currently hold a reference to a valid object instance. *arrow_forward
- What does the total mean in the assignment: Specifications: Lions, Tigers and Bears Pet Clinic needs an application that displays basic services. The application should be designed with check boxes to select the various services (such as office call, vaccination, grooming, etc). As each service is selected, the charge for the service should display in an associated label. (When the check mark is removed, the amount should be removed). As each selection is made, the charges should be added into the total (a variable… consider scope), and displayed in a Total Due area on the application (currency format). Align all numeric data appropriately. Consider what should happen when the check mark is removed. Include at least 8 services that your pet clinic performs. Include a Clear and Exit button. The clear should clear all check boxes, appropriate labels, and the total variable. Use the standard Microsoft naming conventions for all controls. Include appropriate comments in your code.arrow_forwardThe SetName() mutator sets data member name to restaurantName, followed by "s Buffet", and the SetRating() mutator sets data member rating to restaurantRating. In main(), call SetName() and SetRating(), passing arguments inputName and inputRating, respectively. Ex: If the input is Kai 5, then the output is: Restaurant: Kai's Buffet is rated 5 stars. 18 void Restaurant::SetName(string restaurant Name) { name= restaurant Name + "'s Buffet"; 19 20 } 21 22 void Restaurant::SetRating (int restaurant Rating) { 23 rating = restaurantRating; 24 } 25 26 string Restaurant::GetName() const { 27 return name; 28} 29 30 int Restaurant::GetRating() const { 31 return rating; CS Se 3 35 36 32 } ith CamScanner t main() { Restaurant restaurant; string innut Name DD-D-arrow_forwardTrue or False If you need to make a property read only, you simply do not write a set accessor for the property.arrow_forward
- Static & 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_forwardAssignment :1. Class AccountInstance variables:private int accountId; //Auto incrementprivate String accountTitle; //Name of the account holderprivate double openingBal; //Minimum Bal should be 5000private String emailID; //Optional attribute. If user do not provide assign "Email ID NotAvailable"private double accountBal; //The accountBal should never go below the minBalLimitStatic variables:private static int minBalLimit = 100; //The accountBal should never go below thisminBalLimitprivate static int numAccounts; //Count the number of accounts created so fararrow_forwardThe Inventory class contains a Private variable named strId. The variable is associated with the Public ItemId property. An application instantiates an Inventory object and assigns it to a variable named onHand. Which of the following can be used by the application to assign the string "XG45 to the strId variable? a. onHand.ItemId = "XG45" b. ItemId.strId = "XG45" c. onHand.strId = "XG45" d. ItemId.strId = "XG45"arrow_forward
- The __________ parameter of the set accessor is automatically created by the com- piler, and its data type is the same as that of the property.a. propertyb. valuec. memberd. detailarrow_forwardC# According to the following statement, __.Random rn = new Random(); Question 1 options: It declares a variable named rn that can be used to reference an object of the Random type. The new operator creates an object in memory and returns a reference to that object. The = operator assigns the reference that was returned from the new operator to the rn object. All of the above.arrow_forwardCustomer c1 = new Customer("user", "pass"); c1.setPassword("changeme"); Customer c1 = new Customer("user","pass"); c1.password("changeme"); Customer c1 = new Customer("user", "pass"); c1.password = c1.setPassword("changeme"); Customer c1 = new Customer("user","pass"); c1.password = "changeme";arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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