In C++, Implement the following class that represents a clock.
Clock
- hour: int
- minute: int
- meridiem: string
+ Clock()
+ Clock(hr: int, min: int, mer: string)
+ setTime(hr: int, min: int, mer: string): void
+ setHour(hr: int): void + setMinute(min: int): void
+ setMeridiem(mer: string): void
+ getHour(): int
+ getMinute(): int
+ getMeridiem(): string
+ void tick()
+ string asString()
+ string asStandard()
Implementation Details:
• The default constructor should set the clock to midnight (12:00 am)
• Hour must be in the range 1 to 12
• Minute must be in the range 0 to 59
• Meridiem must be the string “am” or the string “pm”
• The constructor that accepts a time as parameters and all of the setters (mutators) must perform error checking. If an error is detected, print an appropriate error message and stop the program. The exit() function can be used to stop the program.
• tick() increments the minute value and handles any rollover. For example, a clock currently set to 11:59 am would become 12:00 pm after executing tick() .
• asString() returns the current time in a format suitable for printing to the screen (i.e. 1:05 pm). Note the leading zero for values of minutes less than 10.
• asStandard() returns the current time in 24-hour clock format(i.e. 13:05). Both the hour and minute values should be 2 digit numbers (use a leading zero for values less than 10).
Here are the first few lines of code to get started:
#include <iostream>
#include <string>
#include <sstream>
class Clock {
};
Clock::Clock()
{
setTime(12, 0, "am");
}
And here is the main() that was given to test this:
int main() {
Clock c;
cout << "After default constructor: " << endl;
cout << c.asString() << endl;
cout << c.asStandard() << endl;
c.tick();
c.tick();
cout << "After 2 ticks: " << endl;
cout << c.asString() << endl;
cout << c.asStandard() << endl;
for (int i = 0; i < 185; i = i + 1)
c.tick();
cout << "After 185 more ticks: " << endl;
cout << c.asString() << endl;
cout << c.asStandard() << endl;
cout << endl << endl;
// Continue testing constructors and tick()
// Continue testing getters and setters....
return 0;
}
Example Execution
After default constructor:
12:00am 00:00
After 2 ticks:
12:02am
00:02
After 185 more ticks:
3:07am
03:07
After parameter constructor:
11:59am
11:59
After 2 ticks:
12:01pm
12:01
After 185 more ticks:
3:06pm
15:06
In: Computer Science
what is the biological perspective explanation for the development of psychological disorders?
In: Psychology
Problem 6-55 Amortization with Equal Payments [LO3]
Prepare an amortization schedule for a five-year loan of $61,000. The interest rate is 8 percent per year, and the loan calls for equal annual payments. (Do not round intermediate calculations and round your answers to 2 decimal places, e.g., 32.16. Leave no cells blank - be certain to enter "0" wherever required.) |
Year | Beginning Balance |
Total Payment |
Interest Payment |
Principal Payment |
Ending Balance |
1 | $ | $ | $ | $ | $ |
2 | |||||
3 | |||||
4 | |||||
5 | |||||
How much interest is paid in the third year? (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.) |
Interest paid | $ |
How much total interest is paid over the life of the loan? (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.) |
Total interest paid | $ |
In: Finance
I need a SWOT Bivoriate strategy Matrix for Chipotle
In: Operations Management
On May 8, 2015, Jett Company (a U.S. company) made a credit sale to Lopez (a Mexican company). The terms of the sale required Lopez to pay 1,340,000 pesos on February 10, 2016. Jett prepares quarterly financial statements on March 31, June 30, September 30, and December 31. The exchange rates for pesos during the time the receivable is outstanding follow.
May 8, 2015 | $0.1855 |
June 30, 2015 | 0.1864 |
September 30, 2015 | 0.1875 |
December 31, 2015 | 0.1858 |
February 10, 2016 | 0.1897 |
Compute the foreign exchange gain or loss that Jett should report on each of its quarterly statements for the last three quarters of 2015 and the first quarter of 2016
June 30, 2015 | ||
September 30, 2015 | ||
December 31, 2015 | ||
March 31, 2016 |
Compute the amount reported on Jett's balance sheets at the end of its last three quarters
June 30 | |
September 30 |
|
December 31 |
In: Accounting
Having Trouble with this C++ assignment THe places that are marked // TODO is where code should be filled in at
Header (myQueue.h)
#ifndef _MYQUEUE_H_
#define _MYQUEUE_H_
using namespace std;
template
class myQueue {
public:
myQueue(int maxSz);
~myQueue();
void enqueue(T item);
T dequeue();
int currentSize();
bool isEmpty();
bool isFull();
private:
T *contents; /*Dynamic initiate (C++ keyword new) the
holder array*/
int front,rear; /*Index in the array of the front and
rear element*/
int arrayLength; /*The length of the contents holder
array*/
/* Keep in mind that the Queue will
only hold up to (arrayLength - 1) elements*/
};
template
myQueue::myQueue(int maxSz) {
// TODO
}
template
myQueue::~myQueue() {
// TODO
}
template
void myQueue::enqueue(T item) {
// TODO
}
template
T myQueue::dequeue() {
// TODO
}
template
int myQueue::currentSize() {
// TODO
}
template
bool myQueue::isEmpty() {
// TODO
}
template
bool myQueue::isFull() {
// TODO
}
#endif
Queue Test (queueTest.cpp)
#include
#include "myQueue.h"
using namespace std;
int main() {
cout << "Testing the template myQueue, try an
integer queue as an example..." << endl;
cout << "Please enter the max size of the int
queue: ";
int capacity;
cin >> capacity;
myQueue testIntQ(capacity);
while(1) {
cout << "Please enter 'e' for
enqueue, 'd' for dequeue, and 's' for stop." << endl;
char userOption;
cin >> userOption;
if(userOption == 's')
break;
switch(userOption) {
case 'e':
if(!testIntQ.isFull()) {
cout << "Please enter
the integer you want to enqueue: ";
int val;
cin >> val;
testIntQ.enqueue(val);
}
else
cout << "Cannot
enqueue. The queue is full." << endl;
break;
case 'd':
if(!testIntQ.isEmpty())
cout <<
testIntQ.dequeue() << " has been popped out." <<
endl;
else
cout << "Cannot pop.
The queue is empty." << endl;
break;
default:
cout << "Illegal input character for
options." << endl;
}
}
return 0;
}
(40’) In myQueue.h, implement the queue class template, myQueue. Keep in mind, the arrayLength needs to be one more than the capacity of the queue. Also, under this implementation, make sure your calculation of currentSize is correct, and the conditions for “Full” and “Empty” are correct. One shortcut could be: once you make sure currentSize() is implemented correctly, you might use it in isFull() and isEmpty(), and the number of elements in the queue must range from 0 to arrayLength – 1.
In: Computer Science
1. Discuss differences between Corporate Strategy and Business Strategy
2. Reasons for diversification and challenges of diversification
In: Operations Management
Beagle Beauties engages in the development, manufacture, and sale of a line of cosmetics designed to make your dog look glamorous. Below you will find selected information necessary to compute some valuation estimates for the firm. Assume the values provided are from year-end 2015. Also assume that the firm’s equity beta is 1.40, the risk-free rate is 2.20 percent, and the market risk premium is 6.4 percent.
a. Using these values, estimate the current share price of Beagle Beauties stock according to the constant dividend growth model. (Do not round intermediate calculations. Round your answer to 2 decimal places.)
b. If The required return is 12.82 percent. Use the clean surplus relationship to calculate the share price for Beagle Beauties with the residual income model. (Do not round intermediate calculations. Round your answer to 2 decimal places.)
Dividends per share | $ | 2.64 | |
Return on equity | 10.00 | % | |
Book value per share | $ | 17.30 | |
Earnings | Cash Flow | Sales | ||||||||
2015 value per share | $ | 5.50 | $ | 6.85 | $ | 25.90 | ||||
Average price multiple | 13.60 | 9.57 | 2.56 | |||||||
Forecasted growth rate | 13.58 | % | 11.66 | % | 7.64 |
% |
In: Finance
What measures can be put in place to identify when IT infrastructure such as virtualised servers would require an upgrade?
In: Computer Science
State Grice's rule of quantity completely.
In: Psychology
Suppose that a country’s inflation rate increases sharply. Explain what happens to inflation tax on the holders of money? . Can you think of anyway in which holders of savings accounts are hurt by the increases in the inflation Rate?
In: Economics
Compensating balance versus discount loan Weathers Catering Supply, Inc., needs to borrow $ 145,000 for 6 months. State Bank has offered to lend the funds at an annual rate of 9.1 % subject to a 9.9 % compensating balance. (Note: Weathers currently maintains $ 0 on deposit in State Bank.) Frost Finance Co. has offered to lend the funds at an annual rate of 9.1 % with discount-loan terms. The principal of both loans would be payable at maturity as a single sum.
a. Calculate the effective annual rate of interest on each loan.
b. What could Weathers do that would reduce the effective annual rate on the State Bank loan?
In: Finance
Show the decimal integer -143 in 10-bit sign magnitude, one's complement, two's complement and excess-511 respectively in the given order
In: Computer Science
2) Part A: In your own words, define performance management and a performance evaluation system. Summarize your understanding of the difference between these two concepts. Part B:Why is it important for HRMs to investigate performance issues to identify the root cause? How would you handle an employee conduct violation, such as harassment or theft? How would you counsel an employee who lacked the skills and knowledge to perform his/her job responsibilities? What type of performance issues(s) could benefit from a performance improvement plan?
In: Operations Management
Calculating Weighted-Average Cost Inventory Values The Brattle Corporation began operations in 2018. Information relating to the company’s purchases of inventory and sales of products for 2018 and 2019 is presented below.
2018
March 1 Purchase 220 units @ $12 per unit
June 1 Sold 120 units @ $25 per unit
September 1 Purchase 100 units @ $15 per unit
November 1 Sold 130 units @ $25 per unit
2019
March 1 Purchase 70 units @ $16 per unit
June 1 Sold 80 units @ $30 per unit
September 1 Purchase 100 units @ $18 per unit
November 1 Sold 90 units @ $35 per unit
Calculate the weighted-average cost of goods sold and ending inventory for 2018 and 2019 assuming use of (a) the periodic method and (b) the perpetual method.
a. Weighted-Average Periodic. Do not round your cost per unit. Do not round until your final answer. Round your answers to the nearest whole number.
2018
Cost of goods sold ___3,234_______
Ending inventory _____906_____
2019
Cost of goods sold ____3,195______
Ending inventory ______945____
b. Weighted-Average Perpetual. Do not round your cost per unit. Do not round until your final answer. Round your answers to the nearest whole number.
2018
Cost of goods sold _____3,195_____
Ending inventory _____945_____
2019
Cost of goods sold __________?
Ending inventory __________?
In: Accounting