Rewrite the Class statement from Exercise 2 so that it uses Private variables rather than Public variables.
Question:
Rewrite the Class statement from Exercise 2 so that it uses Private variables rather than Public variables. Be sure to include the Property procedures and default constructor.
Data From Exercise 2:
Write a Class statement that defines a class named Book. The class contains three Public variables: Title, Author, and Price. The Title and Author variables are String variables. The Price variable is a Decimal variable. Then use the syntax shown in Version 1 in Figure 11-5 to declare a variable that can store a Book object; name the variable fiction. Also write a statement that instantiates the Book object and assigns it to the fiction variable.
Transcribed Image Text:
Instantiating an Object from a Class Syntax – Version 1 (Dim | Private) variableName As className variableName = New className Syntax – Version 2 (Dim | Private) variableName As New className Example 1 (using Syntax Version 1) Private hoursInfo As TimeCard O = hoursInfo = New TimeCard The Private instruction creates a TimeCard variable named hoursInfo; the assignment statement instantiates a TimeCard object and assigns it to the hoursInfo variable. Example 2 (using Syntax Version 2) Dim hoursInfo As New TimeCard The Dim instruction creates a TimeCard variable named hoursInfo and also instantiates a TimeCard object, which it assigns to the hoursInfo variable.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 72% (11 reviews)
Public Class Book Private strTitle As String ...View the full answer
Answered By
FREDRICK MUSYOKI
Professional Qualities:
Solution-oriented.
Self-motivated.
Excellent problem-solving and critical thinking skills.
Good organization, time management and prioritization.
Efficient troubleshooting abilities.
Tutoring Qualities:
I appreciate students as individuals.
I am used to tailoring resources for individual needs.
I can integrate IT into student's lessons.
I am good at explaining concepts.
I am able to help students progress.
I have a wide curriculum knowledge.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Rewrite the subroutine in exercise 4 so that it uses another method (the correct one) to detect the existence of a formula in a cell. Look at the different properties of the Range object in the Help...
-
Write a Class statement that defines a class named Book. The class contains three Public variables: Title, Author, and Price. The Title and Author variables are String variables. The Price variable...
-
Write a Class statement that defines a class named SongInfo. The class contains three Private String variables named _strName, _strArtist, and _strSongLength. Name the corresponding properties...
-
First Ownership orders merchandise from several suppliers from around the world. Each of the suppliers has different shipping or transportation terms. At the end of December, First Ownership had the...
-
If Earth were of uniform density, would your weight increase or decrease at the bottom of a deep mine shaft? Defend your answer.
-
IT Solutions Ltd. has a cash-settled SARs program for employees. These employees will receive a cash payment after five years of service, calculated as the excess of share price over $7.50. In early...
-
You paid \($500\) for supplies and purchased additional supplies on account for \($700\). Later you paid \($400\) of the accounts payable. What is the balance in your Supplies account? a. $1,200 b....
-
Why can't we pay our shareholders a dividend? shouted your new boss. This income statement you prepared for me says we earned $5 million in our first half-year! You were hired last month as the chief...
-
Sanford Sons Ltd. produces two confectionery products: candy apples and cotton candy. In 2019, the Company sold $100,000 worth of candy apples that generated a 48% contribution margin and $80,000...
-
Century Group Ltd. (CGL) is a public company in Ontario that reports under IFRS. The company is financed by 10,200,000 common shares and $23 million in long-term debt. CGL is planning to launch a new...
-
The 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...
-
A class contains an auto-implemented property named Title. Which of the following is the correct way for the default constructor to assign the string Unknown to the variable associated with the...
-
Consider the following: 1. a. Dow Chemical Companys annual report indicated that R&D expenditures were $1,646 million during 2011. How did this amount affect income before income taxes, which was...
-
Your parents have $ 1 0 0 0 0 0 . You convince them to invest their money. Your father told you that he is not welling to loose more than 1 0 , 0 0 0 in the worst scenario.Explain how would you...
-
A federal income tax paid preparer who is a CPA prepared a return for an individual client who wanted to minimize taxable income. The preparer took undisclosed tax return positions that effectively...
-
La Salle Outfitters organizes wilderness tours. For the most recent touring season, the industry volume variance showed La Salle sold 336 more tours than expected, but the market share variance...
-
Sweet Wave Bakery normally produces sourdough bread on a regular basis. It sells approximately 35,000 of this type of bread each year for $3.90 per loaf. The variable costs for each loaf of bread are...
-
Sport Science International is considering launching a new sports drink Warrior-Ade. The estimated project life is three years due to the fierce competition in the sports drink market. The project...
-
Income statement information is presented here for two companies: Instructions (a) Calculate the missing amounts for items [1] to [10]. (b) Calculate the gross profit margin and profit margin for...
-
The registrar of a college with a population of N = 4,000 full-time students is asked by the president to conduct a survey to measure satisfaction with the quality of life on campus. The following...
-
Suppose that A, B, and C are simultaneously transmitting 0 bits, using a CDMA system with the chip sequences of Fig. 2-28(a). What is the resulting chip sequence? Figure 2-28(a) A = (-1-1 -1 +1 +1-1...
-
A CDMA receiver gets the following chips: (1 +1 3 +1 1 3 +1 +1). Assuming the chip sequences defined in Fig. 2-28(a), which stations transmitted, and which bits did each one send? Figure 2-28(a) A =...
-
In Figure 2-28, there are four stations that can transmit. Suppose four more stations are added. Provide the chip sequences of these stations. Figure 2-28 A = (-1-1 -1 +1 +1 -1 +1 +1) B = (-1 -1 +1-1...
-
How do advanced indexing techniques, such as B-trees, hash indexing, and bitmap indexes, improve query performance in RDBMS, and what factors should be considered when choosing the appropriate...
-
Assume that CAPM holds. You are given the following information about stock X and the market portfolio, M: E(r) Riskless Asset (f) 0.05 (5%) 0.00 Stock X ? 0.40 Market Portfolio 0.10 0.20 (M) You are...
-
On January 1, 2024, Taco King leased retail space from Fogelman Properties. The 10-year finance lease requires quarterly variable lease payments equal to 3% of Taco King's sales revenue, with a...
Study smarter with the SolutionInn App