Questions
in C++ Using your previous homework code: 1) Add a default constructor for the runners. (...

in C++

Using your previous homework code:

1) Add a default constructor for the runners. ( one that has no parameters)

2) Add a constructor that takes a name and a bib number

3) Add a constructor that takes a name , a bib number and a sex.

Add setter functions that sets the time:

1) one that takes a string of the format : hh:mm:ss

2) one that takes an int that is the number of seconds the runner took to complete the race.

Please Note: You decide what format inside the class to store the time amount.  

Add getter functions that return the time:

1) one that returns a string in the format : hh:mm:ss

2) one that returns an int that this the time in seconds.

Add a comment section to your class and explain why you chose some things.

1) What data type did you decide on in the class for the time, why

2) What was an alternative? Is your decision a big decision or a small decision? why

Please note : Again pick one C++ data type inside the class to store the time.

Do not use two variables to store the time.

Please note: if you write conversion functions that if expected. Do not make them public.  

Please note: on the time returned as a string please test and verify that times like these contain the correct zeros not blanks. the format will always be either: ( b = blank, hh = hours, mm = minutes, ss = seconds )

bh:mm:ss

hh:mm:ss

so a time like 1:03:02 will NOT be displayed as : 1:3:2. I strongly suggest testing in these areas.

You may want to convert from a string to an integer for you students here is some

sample code

String conversion using stoi() or atoi()
stoi() : The stoi() function takes a string as an argument and returns its value. Following is a simple implementation:

filter_none

edit

play_arrow

brightness_4

// C++ program to demonstrate working of stoi()

// Work only if compiler supports C++11 or above.

#include <iostream>

#include <string>

using namespace std;

  

int main()

{

    string str1 = "45";

    string str2 = "3.14159";

    string str3 = "31337 geek";

  

    int myint1 = stoi(str1);

    int myint2 = stoi(str2);

    int myint3 = stoi(str3);

  

    cout << "stoi(\"" << str1 << "\") is "

         << myint1 << '\n';

    cout << "stoi(\"" << str2 << "\") is "

         << myint2 << '\n';

    cout << "stoi(\"" << str3 << "\") is "

         << myint3 << '\n';

  

    return 0;

}

Output:

stoi("45") is 45
stoi("3.14159") is 3
stoi("31337 geek") is 31337 



Please Note:  
You may decide that you need a function that returns a 2 character long string 
given an integer.   This is starter code .   
It does not fully help you in this project you will need to modify or add 
a bit of stuff to get it to be truly helpful. the statement 
temp+=number%10+48;
could be coded as :
temp+=number%10+'0';

Here is some starter code:

string convertInt(int number)
{
    if (number == 0)
        return "0";
    string temp="";
    string returnvalue="";
    while (number>0)
    {
        temp+=number%10+48;
        number/=10;
    }
    for (int i=0;i<temp.length();i++)
        returnvalue+=temp[temp.length()-i-1];
    return returnvalue;
}

this is my code from my previous homework:

#include<iostream>

#include<string>

using namespace std;

class Runner

{

private:

string bibnumber;

char gender;

int age;

string name;

string time;

public:

Runner()

{

bibnumber=" ";

gender=' ';

age=0;

name=" ";

time=" ";

}

int getAge()

{

return age;

}

string getName()

{

return name;

}

string getTime()

{

return time;

}

string getBin()

{

return bibnumber;

}

char getGender()

{

return gender;

}

void setCombinedGenderBib ( string bib)

{

gender=bib[0];

bibnumber=bib.substr(1,bib.length());

}

void setName(string name)

{

this->name=name;

}

void setTime(string time)

{

this->time= time;

}

void setAge(int age)

{

this->age= age;

}

};

int main()

{

Runner runner;

runner.setName("john");

runner.setAge(23);

runner.setTime("01:04:37");

runner.setCombinedGenderBib("M4321");

cout<<"Name : "<<runner.getName()<<endl;

cout<<"Bin Number : "<<runner.getBin()<<endl;

cout<<"Age : "<<runner.getAge()<<endl;

cout<<"Gender : "<<runner.getGender()<<endl;

cout<<"Time : "<<runner.getTime()<<endl;

return0;

In: Computer Science

Steam distillation. ANSWER IN DETAIL AND I WILL REWARD FIVE STARS TO FIRST PERSON TO ANSWER!!!!!!...

Steam distillation. ANSWER IN DETAIL AND I WILL REWARD FIVE STARS TO FIRST PERSON TO ANSWER!!!!!!

A student steam distilled a mixtrue of toluene (bp 110.8 degrees Celsius) and water and noticed that distillate contained a larger volume of touleune than water. The student said to the professor, "I know there is something wrong with my experiment. I should have more water than toleune because water has a lowerboiling point. Should I redo the experiment?" The professor replied "do whatever you need to do" A classmate then said, "No, you dont need to redo it you DO have more water."

Explain in detail why the classmate is correct. Use calculations to support your explanation. Label all quantities used. Include all units.

In: Chemistry

The conditions underlying supply and demand for labor have been different in Europe from that in...

The conditions underlying supply and demand for labor have been different in Europe from that in the USA, in a way that has created a much higher natural rate of unemployment. Discuss various factors which contribute to this

In: Economics

How will the structure of the labor market, including the gig economy effect consumer confidence? How...

  • How will the structure of the labor market, including the gig economy effect consumer confidence? How will it effect the growth of wealth of households? How will it effect investment spending?

In: Economics

Write a C++ function that receives an integer array along with its specified length. The function...

Write a C++ function that receives an integer array along with its specified length. The function will replace only one of the smallest integers and one of the largest integers by 0. Then the function will return the average for the rest of the values in the array.

Test case array: 3, 8, 2, 6, 5, 3, 4, 7, 8, 2, 10, 7

Function should return: 5.3

In: Computer Science

Imagine that you are in the very first stages of trying to figure out how to...


Imagine that you are in the very first stages of
trying to figure out how to build a nuclear power reactor or a nuclear weapon
using fission. The first step you would consider is what kind of nuclei could
live for a reasonable length of time so that you could keep it around, but
would also be able to decay by some process that would give off lots of energy


1.Explore the conditions that produce a chain reaction (where a
substantial fraction of the nuclei fission) and those that do not. You want to
design a nuclear bomb. What are three design characteristics that are critical
to creating an effective bomb as oppose to a dud? Include the physics reasoning
behind why these are so important.

In: Physics

George has been selling 8,000 T-shirts per month for $9.50. When he increased the price to...

George has been selling 8,000 T-shirts per month for $9.50. When he increased the price to $10.50, he sold only 5,000 T-shirts.

Which of the following best approximates the price elasticity of demand?

-4.1538

-5.0769

-4.6154

-3.6923

Suppose George's marginal cost is $4 per shirt.

Before the price change, George's initial price markup over marginal cost was approximately ( 0.6368 OR 0.5211 OR 0.2895 OR 0.5789) . George's desired markup is   .

Since George's initial markup, or actual margin, was( LESS or GREATER) than his desired margin, raising the price was ( profitable or not profitable) .

In: Economics

Write a short essay about state and local taxes. Your answer should include the different types...

Write a short essay about state and local taxes. Your answer should include the different types of state and local taxes, their definitions and their classification into either activity based tax or transaction based tax. Please state your answer in a good form which will includes introduction, structure and conclusion. 5 paragraphs
1 page

In: Accounting

Polaski Company manufactures and sells a single product called a Ret. Operating at capacity, the company...

Polaski Company manufactures and sells a single product called a Ret. Operating at capacity, the company can produce and sell 54,000 Rets per year. Costs associated with this level of production and sales are as follows:

  

Unit Total
  Direct materials $ 24.00 $ 1,296,000
  Direct labour 17.00 918,000
  Variable manufacturing overhead 12.00 648,000
  Fixed manufacturing overhead 18.00 972,000
  Variable selling expense 4.00 216,000
  Fixed selling expense 6.00 324,000
  Total cost $ 81.00 $ 4,374,000

  

     The Rets normally sell for $86 each. Fixed manufacturing overhead is constant at $972,000 per year within the range of 31,000 through 54,000 Rets per year.

1)Assume that Polaski Company expects to sell only 54,000 Rets through regular channels next year. The Canadian Forces would like to make a one-time-only purchase of 23,000 Rets. The Forces would pay a fixed fee of $3.30 per Ret, and in addition it would reimburse Polaski Company for all costs of production (variable and fixed) associated with the units. Thus, accepting the Canadian Forces’ order would require giving up regular sales of 23,000 Rets. If the Forces’ order is accepted, by how much will profits be increased or decreased from what they would be if the 23,000 Rets were sold through regular channels?

In: Accounting

Which cobalt complex was favored when the solution was taken off the heat plate and put...

Which cobalt complex was favored when the solution was taken off the heat plate and put in an ice bath? The solution contained deionzied water, ethanol, and cobalt II chloride. The solution went from blue to pink. If you could explain this using Le Chatelier's principle, thank you!

In: Chemistry

Question 1 How could you identify bacteria in a biofilm if it could not be cultured?...

Question 1

How could you identify bacteria in a biofilm if it could not be cultured?

Question 2

How can bacteria produce or modify enzymes to control how much metabolic product is made?

In: Biology

Should the government be downsized? Which functions should be cut back? Which ones should be expanded?

Should the government be downsized? Which functions should be cut back? Which ones should be expanded?

In: Economics

Briefly describe the purpose of “blacklisting” and other authoritarian measures during Red Scares in the United...

Briefly describe the purpose of “blacklisting” and other authoritarian measures during Red Scares in the United States.

In: Economics

QUESTION 1 The law of diminishing marginal productivity pertains to_____: a. the short run. b. the...

QUESTION 1

  1. The law of diminishing marginal productivity pertains to_____:

    a.

    the short run.

    b.

    the long run.

    c.

    both the short run and the long run.

    d.

    the short run for small firms, and the long run for large firms.

1 points   

QUESTION 2

  1. Assume that you own a sole proprietorship. Your first year earnings were $75,000, and your explicit costs were $55,000.  If you could have worked at another establishment and earned $25,000, which of the following is true?

    a.

    Your firm earned an economic profit of $20,000.

    b.

    Your firm's total implicit costs were $80,000.

    c.

    Your firm sustained an economic loss of $5,000.

    d.

    Your firm's total costs are $100,000.

1 points   

QUESTION 3

  1. Which of the following is true regarding accounting profit?

    a.

    It is typically smaller than economic profit.

    b.

    It includes all explicit and implicit cost of production.

    c.

    It includes depreciation.

    d.

    All of the above.

1 points   

QUESTION 4

  1. Marginal cost is understood as the change in__________ when producing one more unit of output. In the short run, marginal cost can also be determined by the change in__________ when producing one more unit of output.

    a.

    variable cost; fixed cost

    b.

    total cost; fixed cost

    c.

    fixed cost; variable cost

    d.

    total cost; variable cost

1 points   

QUESTION 5

  1. Which of the following are characteristics of a perfectly competitive market?

    a.

    Firms are price takers.

    b.

    Firms produce identical or nearly identical products.

    c.

    Firms can enter the market without any restrictions.

    d.

    All of the above.

1 points   

QUESTION 6

  1. An organization with 50 employees will add 10 employees next month. This is_____:

    a.

    a long run decision.

    b.

    a long run and a short run decision.

    c.

    a short run decision.

    d.

    none of the above.

1 points   

QUESTION 7

  1. Fixed inputs are_____:

    a.

    those inputs to production that have a fixed price.

    b.

    those inputs to production that result in a fixed variable product.

    c.

    those inputs to production that cannot be varied in the short run.

    d.

    those inputs to production that have a fixed market.

1 points   

QUESTION 8

  1. When deciding whether to continue operations or shutdown, a perfectly competitive firm should_____:

    a.

    continue operations if the price of the firm's product falls below the minimum average variable cost.

    b.

    shut down if the price of the firm's product falls below the minimum average variable cost.

    c.

    continue operations if the marginal cost of a new invention for the firm surpasses average variable cost.

    d.

    shut down if it can cover all of its costs, but only at a diminishing marginal rate.

1 points   

QUESTION 9

  1. If the total output rises while the cost per unit fails, a firm is understood to be enjoying_____:

    a.

    increased profits.

    b.

    economies of scale.

    c.

    maximum efficiency.

    d.

    all of the above.

1 points   

QUESTION 10

  1. Firms that compete in perfectly competitive markets must decide_____:

    a.

    the quantity to produce.

    b.

    the price to charge.

    c.

    the price to charge and the quantity to produce.

    d.

    none of the above.

In: Economics

3. NJ wants to attract businesses to move to NJ from other states. It offers firms...

3. NJ wants to attract businesses to move to NJ from other states. It offers firms a tax break on profits earned in NJ over the next 10 years. How could you empirically test whether this tax break has any effect?

In: Economics