Using a vector of integers that you define.
Write a C++ program to run a menu driven program with the following choices:
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Make sure your program conforms to the following requirements:
2. Write a function called getValidAge that allows a user to enter in an integer and loops until a valid number that is >= 0 and < 120 is entered. It returns the valid age. (5 points).
3. Write a function called displayAges that takes in a vector of integers as a parameter and displays the ages in the format in the sample run below. (10 points).
4. Write a function called AddAge that takes in a vector of integers by reference as a parameter, asks the user to input a valid age, and adds it to the vector of integers . (15 points).
5. Write a function called getAverageAge that takes in a vector of integers as a parameter, computes, and returns the average age. (15 points).
6. Write a function called getYoungestAge that takes in a vector of integers as a parameter, computes, and returns the youngest age. (15 points).
7. Write a function called getNumStudentsVote that takes in a vector of integers as a parameter, computes, and returns the number of ages in the vector that are >= 18. (15 points).
8. Write a function called RemoveStudentsLessThanSelectedAge that takes in a vector of integers as a parameter, asks the user for an age, creates a new vector of integers that only contains the ages in the parameter vector which are >= the age selected by the user and returns the new vector. (20 points).
9. Add comments wherever necessary. (5 points)
NOTE: You must take care of the case when the vector is empty and an operation is being performed on it. In such cases the program should display a 0 for the given result.
Sample Runs:
NOTE: not all possible runs are shown below.
Welcome to the students age in class program!
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..1
Student ages:
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..3
Average age = 0
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..4
Youngest age = 0
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..5
Number of students who can vote = 0
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..6
Please enter in the age...
5
Students removed
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..2
Please enter in the age...
4
Age added
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..2
Please enter in the age...
24
Age added
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..2
Please enter in the age...
18
Age added
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..2
Please enter in the age...
12
Age added
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..1
Student ages:
4 24 18 12
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..3
Average age = 14
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..4
Youngest age = 4
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..5
Number of students who can vote = 2
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..6
Please enter in the age...
15
Students removed
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..1
Student ages:
24 18
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..3
Average age = 21
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..4
Youngest age = 18
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..5
Number of students who can vote = 2
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..-8
Select an option (1..7)..8
Select an option (1..7)..1
Student ages:
24 18
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..2
Please enter in the age...
-8
Please enter in a valid age (1-120) ...
130
Please enter in a valid age (1-120) ...
55
Age added
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..1
Student ages:
24 18 55
1) Display the ages
2) Add an age
3) Display the average age
4) Display the youngest age
5) Display the number of students who can vote
6) Remove all students less than a given age
7) Quit
Select an option (1..7)..7
Process finished with exit code 0
In: Computer Science
Cain Components manufactures and distributes various plumbing products used in homes and other buildings. Over time, the production staff has noticed that products they considered easy to make were difficult to sell at margins considered reasonable, while products that seemed to take a lot of staff time were selling well despite recent price increases. A summer intern has suggested that the cost system might be providing misleading information.
The controller decided that a good summer project for the intern would be to develop, in one self-contained area of the plant, an alternative cost system with which to compare the current system. The intern identified the following cost pools and, after discussion with some plant personnel, appropriate cost drivers for each pool. There were:
| Cost Pools | Costs | Activity Drivers | |
| Receiving | $ | 2,580,000 | Direct material cost |
| Manufacturing | 22,680,000 | Machine-hours | |
| Machine setup | 2,700,000 | Production runs | |
| Shipping | $ | 4,400,000 | Units shipped |
In this particular area, Cain produces two of its many products: Standard and Deluxe. The following are data for production for the latest full year of operations:
| Products | ||||||
| Standard | Deluxe | |||||
| Total direct material costs | $ | 1,160,000 | $ | 560,000 | ||
| Total direct labor costs | $ | 2,160,000 | $ | 960,000 | ||
| Total machine-hours | 480,000 | 360,000 | ||||
| Total number of setups | 400 | 600 | ||||
| Total pounds of material | 72,000 | 36,000 | ||||
| Total direct labor-hours | 16,000 | 18,000 | ||||
| Number of units produced and shipped | 80,000 | 20,000 | ||||
The intern decides to look more closely at the manufacturing activity and determines that it can be broken down into two activities: production and engineering. Production covers the costs of ongoing manufacturing while engineering includes those activities dealing with engineering changes, design modifications, and so on.
The costs attributed to production are $12,180,000 and the costs attributed to engineering are $10,500,000. After discussion with plant engineers, the intern decides that the best cost driver for engineering is setups, because most of the work arises from changes in the way the product is run.
Required:
1. Compute the totals of the cost driver rates shown below. (Round intermediate calculations and "Manufacturing" answer to 2 decimal places.)
Receiving (% of material dollars)
Manufacturing (per machine hour)
Engineering (per setup)
Machine setup (per setup)
Shipping (per unit)
2. What unit product costs will be reported for the two products if the revised ABC system is used?
Standard Deluxe
Direct Costs
Overhead:
Receiving
Manufacturing
Engineering
Machine Setup
Shipping
Number of units
In: Accounting
Gains from trade
Consider two neighboring island countries called Felicidad and Arcadia. They each have 4 million labor hours available per month that they can use to produce jeans, wheat, or a combination of both. The following table shows the amount of jeans or wheat that can be produced using one hour of labor.
|
Jeans |
Wheat |
|
|---|---|---|
| (Pairs per hour of labor) | (kilograms per hour of labor) | |
| Felicidad | 5 | 20 |
| Arcadia | 4 | 8 |
Initially, suppose Arcadia uses 1 million hours of labor per month to produce jeans and 3 million hours per month to produce wheat, while Felicidad uses 2 million hours of labor per month to produce jeans and 2 million hours per month to produce wheat. Consequently, Felicidad produces 10 million pairs of jeans and 40 million kilograms of wheat, and Arcadia produces 4 million pairs of jeans and 24 million kilograms of wheat. Assume there are no other countries willing to trade goods, so in the absence of trade between these two countries, each country consumes the amount of jeans and wheat it produces.
Felicidad's opportunity cost of producing one pair of jeans is of wheat, and Arcadia's opportunity cost of producing one pair of jeans is of wheat. Therefore, has a comparative advantage in the production of jeans and has a comparative advantage in the production of wheat.
Suppose that each country completely specializes in the production of the good in which it has a comparative advantage, producing only that good. In this case, the country that produces jeans will produce pairs per month, and the country that produces wheat will produce kilograms per month. In the following table, enter each country's production decision on the second row of the table (marked "Production").
Suppose the country that produces jeans trades 11 million pairs of jeans to the other country in exchange for 33 million kilograms of wheat. In the following table, select the amount of each good that each country exports and imports in the boxes across the row marked "Trade Action," and enter each country's final consumption of each good on the line marked "Consumption."
When the two countries did not specialize, the total production of jeans was 14 million pairs per month and the total production of wheat was 64 million kilograms per month. Because of specialization, the total production of jeans has increased by pairs per month, and the total production of wheat has increased by kilograms per month. Because the two countries produce more jeans and more wheat under specialization, each country is able to gain from trade. Calculate the gains from trade that is, the amount by which each country has increased its consumption of each good relative to the first row of the table. In the following table, enter this difference in the boxes across the last row (marked "Increase in consumption").
|
Felicidad |
Arcadia |
|||
|---|---|---|---|---|
| Jeans | Wheat | Jeans | Wheat | |
| (Millions of pairs) | (Millions of kilograms) | (Millions of pairs) | (Millions of kilograms) | |
| Without Trade | ||||
| Production and consumption | 10 | 40 | 4 | 24 |
| With Trade | ||||
| Production | ||||
| Trade Action | ||||
| Consumption | ||||
| Gains from Trade | ||||
| Increase in consumption | ||||
In: Economics
A sample of 1700 computer chips revealed that 80% of the chips do not fail in the first 1000 hours of their use. The company's promotional literature states that 79% of the chips do not fail in the first 1000 hours of their use. The quality control manager wants to test the claim that the actual percentage that do not fail is different from the stated percentage. Is there enough evidence at the 0.05 level to support the manager's claim?
Step 1 of 7: State the null and alternative hypotheses
Step 2 of 7: Find the value of the test statistic. Round your answer to two decimal places.
Step 3 of 7: Specify if the test is one-tailed or two-tailed.
Step 4 of 7: Determine the P-value of the test statistic. Round your answer to four decimal places.
Step 5 of 7: Identify the value of the level of significance.
Step 6 of 7: Make the decision to reject or fail to reject the null hypothesis
Step 7 of 7: State the conclusion of the hypothesis test.
In: Statistics and Probability
In: Biology
Use the following labor budget data for Roy & Miller Accounting, LLP. Partner Salaries $ 400,000 Partner Benefits (40%) 160,000 Total Partner Compensation $ 560,000 Staff Accountant Salaries $ 600,000 Staff Benefits (40%) 240,000 Total Staff Compensation $ 840,000 The budgeted overhead cost for the year is $1,260,000. The company has estimated that one-third of the budgeted overhead cost is incurred to support the firm's two partners, and two-thirds goes to support the staff accountants. The current audit bid for Monoco Industries requires $18,000 in direct partner professional labor, $30,000 in direct staff accountant professional labor, $5,000 in direct material. If overhead is applied on the Monoco engagement based on a single-cost driver basis, what is the total cost of the engagement?
In: Accounting
You are the audit senior on the Pet Care Pty Limited (Pet Care) audit. Pet Care is a distributor of pet care products including shampoos, lotions and a small range of toys. Pet Care uses an on-line computer system. No goods are manufactured in-house; rather, Pet Care maintains a stock of raw materials and sub-contracts the manufacture of its products to third parties. Approximately 50 suppliers and sub-contractors are used and all have proven to be reliable. You have made the following notes about the inventory system: Procedures for raw materials • Separate systems, staff and warehouses are maintained for both raw materials and finished goods. • Purchase orders are automatically generated by the computer when stocks of any raw material fall below 70% of the prior month’s usage. The purchase orders contain the following details: date; supplier name and address; raw material needed. • Three copies of the purchase order are produced and distributed as follows: Copy 1—to warehouse to enable follow up of late orders. Copy 2—filed by accounts clerk in date order. Copy 3—sent to supplier. • When raw material stocks are received, the bar codes attached to the delivery boxes by the supplier are scanned into the system. A two-part Goods Received Note (GRN) is then produced: Copy 1—matched to warehouse copy of purchase order by stores staff. Copy 2—filed by accounts clerk. The scanning process is aborted if the codes do not match those on the masterfile. Procedures for finished goods • Production orders are automatically generated when finished goods fall below 60% of the prior month’s sales. The production orders contain the following details: date; sub-contractor’s name; raw materials required; finished goods needed. Asia Pacific College of Business & Law Semester 1 2020 Page 7 of 11 • Two copies of the production order are produced: Copy 1—to raw materials store for use as a picking slip, then it is packed with goods and sent to the supplier. Copy 2—filed by production controller in date order. • When the finished goods stocks are received, the bar codes attached to the delivery boxes by the supplier are scanned into the system. A two-part GRN is then produced: Copy 1—matched to production controller’s copy of production order. Copy 2—filed by accounts clerk. The scanning process is aborted if the codes to not match those on the masterfile. General notes • The computer automatically selects the supplier of both raw materials and finished goods based on: the latest price (as per their most recent invoice). their delivery times (based on the number of days between the date the purchase/ production order is raised and the date the goods are scanned by the warehouse). • Password access is as follows: Stores staff (raw materials): Purchase order printing for raw materials only. GRN printing for raw materials. Stores staff (finished goods): GRN printing for finished goods. Production controller: Production order printing, masterfile amendments. Accounts clerk: Masterfile amendments. Masterfile amendments • The stock masterfile contains details of: existing stock items including codes and warehouse location; approved suppliers and sub-contractors. • Orders will only be generated to suppliers and sub-contractors recorded on the masterfile. • Masterfile changes are made by the production controller for both raw materials and finished goods inventory. A masterfile amendment form is completed by the production controller as a record of the changes made. Asia Pacific College of Business & Law Semester 1 2020 Page 8 of 11 REQUIRED: (a) Identify six (6) weaknesses in the internal controls described. Discuss the implications of each of the weaknesses you have identified. (b) Assume your IT audit division is to perform testing of controls for the inventory systems described. Identify two tests that you would recommend they perform.
In: Accounting
Suppose a committee wants to decide the service award for last year. There are a total of 6 candidates, Alice, Brigitte, Chris, Dave, Emma, and Frank. Among the six candidates, Alice, Brigitte, and Emma are females and the rest three are males. The committee must decide exactly three people to be awarded, and the nominations must meet all of the following criteria. At least one female must be nominated; Chris and Emma cannot be both nominated; Since Alice and Brigitte work together all the time last year, if one of them is nominated, so is the other; Exactly one of the two people Chris and Dave will be nominated; The nomination cannot be a list containing exactly Alice, Brigitte, and Chris; If Chris cannot get the nomination, neither can Brigitte. Now, as the chair of the committee, how do you decide the nominations?
In: Statistics and Probability
You want to come up with a plan to save for retirement. You will contribute to your retirement account monthly for 40 years. One month after your last contribution you will begin monthly withdrawals of $7,500 from that retirement account. You earn 6.6% APR while you’re contributing to your retirement savings and 3.6% APR while you are withdrawing. You want to have enough money to finance 35 years in retirement. (Assume compounding frequencies match the payment frequencies.)
What kind of cash flow pattern are the retirement withdrawals?
a.Lump sum b.Annuity c. Perpetuity d. Growing perpetuity
What variable would you solve for to find the value of all the retirement withdrawals at the beginning of retirement?
a. Present value b. Payment c.Interest rate d. Time e. Future Value
What is the value of the retirement withdrawals at the beginning of retirement?
What kind of cash flow pattern is the savings contributions?
a. Lump sum b. Annuity c. Perpetuity b. Growing perpetuity
What variable would you solve for to find the monthly savings contribution?
a. Present value b. Payment c. Interest rate d. Time e. Future Value
What is the monthly savings contribution you must make to fully fund your retirement?
In: Finance
|
Work & Rest is an all inclusive hotel operating as a monopoly in a mid-sized community. The manager estimates that the hotel's total costs are described by the equation C = 0.05Q2 + 10Q + 15000, where Q is the number or persons serviced and P is the price paid per person. Although it is located in a mid-sized community, it is close to a major highway that runs along the east coast. Often times, travelers would use the services of Work & Rest as a stop in their commute between two major citys. As such, the market demand for its service is described by the equation P = 160 - 0.2Q. 1. Given the current market conditions, Work & Rest's profit-maximizing quantity is Blank 1 and the price charged per person is Blank 2 ( 4 points) Consider that after a series of reports from special interest groups, the local government decides to regulate Work & Rest by using the optimal pricing policy. 2. Given the successful implementation of the government's policy, Work & Rest's profit-maximizing quantity is Blank 3 (2 points) 3. Given the successful implementation of the government's policy, what is Work & Rest's profit at its profit maximizing quantity? Blank 4 (4 points)I 4. If the policy remains in place, and there are no further external shocks to the market, is it likely that West & Rest will continue to operate and provide service? (In the space provided enter will or will not) In the long run, West & Rest Blank 5 continue to provide service in this mid-sized community. (2 points) |
In: Economics