Develop the following class: Class Name: ImprovedArrayBasedStack Access Modifier: public Implements: ImprovedStackInterface Instance variables Name: top Access modifier: private Data type: int Name: stack Access modifier: private Data type: T[] (an array of parameterized type) Constructors Name: ImprovedArrayBasedStack Access modifier: public Parameters: none (default constructor) Task: sets the value of top to -1 sets the stack to refer to an array of Objects with 100 elements which are type cast to T[] Name: ImprovedArrayBasedStack Access modifier: public Parameters: size (data type int) Task: sets the value of top to -1 sets the stack to refer to an array of Objects with the number of elements equal to the size parameter which are type cast to T[] Methods Name: push Access modifier: public Parameters: item (data type T, parameterized type) Return type: void Throws: StackFullException Task: if the value of top is less than the length of the stack minus 1 then increase the value of top by 1 and place the item at the top of the stack, otherwise throw a StackFullException with the message "Not enough room for one item" Name: push Access modifier: public Parameters: item1 (data type T, parameterized type), item2 (data type T, parameterized type) Return type: void Throws: StackFullException Task: if the value of top is less than the length of the stack minus 2, then increase the value of top by 1 and place item1 at the top of the stack, then increase the value of top by 1 and place item2 at the top of the stack, otherwise throw a StackFullException with the message "Not enough room for two items" Name: pop Access modifier: public Parameters: none Return type: void Throws: StackEmptyException Task: if the value of top is greater than -1 then remove the item at the top of the stack by replacing it with null and decrease the value of top by 1, otherwise throw a StackEmptyException with the message "No item to remove" Name: doublePop Access modifier: public Parameters: none Return type: void Throws: StackEmptyException Task: if the value of top is greater than 0, then remove the item at the top of the stack by replacing it with null and decrease the value of top by 1, then remove the item at the top of the stack by replacing it with null and decrease the value of top by 1, otherwise throw a StackEmptyException with the message "There are less than two items in the stack" Name: top Access modifier: public Parameters: none Return type: T (parameterized type) Throws: StackEmptyException Task: if the value of top is greater than -1 then return the item at the top of the stack, otherwise throw a StackEmptyException with the message "Top attempted on an empty stack"
In: Computer Science
International Taxation Question
How is the 2016 Model Treaty consistent with OECD BEPS project?
In: Accounting
What is a good reference for Why prostatitis and infection happens? The reference need to be after 2016.
In: Nursing
A simple model of survey response of SOCIAL MEDIA AND FAKE NEWS IN THE 2016 Election ?
No HandWriting ?
In: Operations Management
What is the SOCIAL MEDIA AND FAKE NEWS IN THE 2016 Election Empirical calibration? No Hand Writing
In: Operations Management
How will oil production in Saudi Arabia, affect competition for the Stanley Cup in 2015-2016?
In: Economics
HW 8-1a
1.) Referring to the UML class diagram, create a program that utilizes the Student class.
- id : Integer
- units : Integer
- name : String
+ Student ( ) :
+ Student (id : Int, name : String, units : Int) :
+ ~Student( ) :
+ setID(id : Integer) : void
+ setName(name: String) : void
+ setUnits(units : Integer ) : void
+ displayRecord() : void
2.) Include 3 files:
- Source.cpp
- Student.h
- Student.cpp
3.) In main(), declare two objects of Student type, named s1 and s2.
4.) In main(), the s1 object calls its displayRecord() function. Here is the output:
ID: 0
Name:
Units: 0
5.) Then in main(), the s2 object calls its displayRecord() function. Here is the output:
ID: 100
Name: Tom P. Lee
Units: 12
6.) Then in main(), use the set functions to set to assign these values to the s1 object:
ID: 101
Name: John Lee Hooker
Units: 15
7.) Finally, the s1 object calls its displayRecord() function again. Here is the output:
ID: 100
Name: John Lee Hooker
Units: 15
/* OUTPUT
Here is student #1:
ID: 0
Name:
Units: 0
Here is student #2:
ID: 100
Name: Tom P. Lee
Units: 12
Here is student #1 after the set functions:
ID: 100
Name: John Lee Hooker
Units: 15
1) Referring to the following UML class diagram, create a program that utilizes three class specifications:
Student, UnderGrad, and Grad
- Include these 7 files in your project:
- main.cpp
- Student.h
- Student. cpp
- UnderGrad.h
- UnderGrad.cpp
- Grad.h
- Grad.cpp
2.) In main(), declare two objects of UnderGrad and Grad type, respectively, as show below:
int main()
{
UnderGrad underGrad(100, 9, "Tom Lee", "Freshman");
Grad grad(101, 12, "Jim Jones", "PHD");
3.) In main(), the object, underGrad, calls its displayRecord() function. Here is the output:
ID: 100
Name: Tom Lee
Units: 9
Class: Freshman
4.) In main(), the object, grad, calls its displayRecord() function. Here is the output
of the function:
ID: 101
Name: Jim Jones
Units: 12
Degree: PHD
5.) Then, in main(), the object, grad, calls its setUnits() function, and changes the number of units
from 12 to 15.
6.) Finally, in main(),the object, grad, calls its displayRecord() function. Here is the output
of the function:
ID: 101
Name: Jim Jones
Units: 15 ß (Units has changed to 15)
Degree: PHD
Please make a code on C++ language, and please add comments for each codes.
In: Computer Science
General Mills contracted with Max Grains Corp., to begin supplying them with wheat and other grains for their products. The contract was signed in December 2016 and the first delivery is expected for September 2019. At what time will General Mills acquire an interest in the goods that Max Grains will supply?
Group of answer choices
At the time they are harvested
At the time they entered the contract on December 2016
At the time the goods are shipped or are designated by the seller (Max Grains)
When General Mills select the goods
In: Operations Management
Surplus Warehouse purchased a forklift on January 1, 2016, for $12,000. The forklift is expected to last for five years and have a residual value of $1,200. Surplus Warehouse uses the double-declining-balance method for depreciation.
a. Calculate the depreciation expense, accumulated depreciation, and book value for each year of the forklift’s life. Round any depreciation calculations to the nearest dollar.
| Year | Annual Depreciation |
Accumulated Depreciation |
Book Value |
|---|---|---|---|
| 2016 | $ | $ | $ |
| 2017 | |||
| 2018 | |||
| 2019 | |||
| 2020 |
In: Finance
For the year ended 31 December 2016 a company earned a profit
after interest and tax of
£480,000. The company’s share price is £12 per share. The following
are extracts from the
company’s Statement of financial position at 31 December
2016:
Ordinary share capital (50p shares) £200,000
Retained earnings £380,000
Revaluation reserve £80,000
Long-term 10% Bank loan £48,000
The company’s price earnings (PE) number and return on equity for
the period were:
In: Finance