In: Economics
Programming Project #6: Bowling Team
need to use python
Problem
Expected Duration: 3-4 hours
Prerequisites: None
Knowing that you are a budding programmer, your friends have
asked you to create a scoring program for your Saturday bowling
league. Your program should take a name, team number, and score for
each player, and should deal with any number of players, but have 3
people to a team.
Your program should ignore invalid inputs, and not crash. Your
program should print the following lists in columns:
Last, your program should write each of the lists and the
summary information
to a text file called game_results.txt in the same format it is
displayed on the screen.
Note: You have the option of using pandas Dataframes in your
program. Just make sure the console and file output
has the required structure and format.
In: Computer Science
Write a program that implements a stack of integers, and exercises the stack based on commands read from cin. To do this, write a class called Stack with exactly the following members:
class Stack {
public:
bool isEmpty();
// returns true if stack has no elements stored
int top();
// returns element from top of the stack
// throws runtime_error("stack is empty")
int pop();
// returns element from top of the stack and removes it
// throws runtime_error("stack is empty")
void push(int);
// puts a new element on top of the stack
private:
vector<int> elements;
};
The program should read commands from cin until either end-of-file is reached or the command end is entered. (You can manually test for end-of-file by entering CTRL-D.) Each time the program expects a new command it should first print a prompt: "stack> "
Your program should catch all errors that happen and continue execution until the end command or end-of-file.
In case the command push is read, the program should read an integer value from cin and push it onto the stack. In case top is read, the program should print the top integer of the stack to cout. In case pop is read, the program should print the top integer of the stack to cout, and remove it from the stack. In case the command list is read, the program should print all values currently on the stack, without modifying the stack. (Exact format see below.)
Your program should check whether a "number" to be pushed is actually a number. If not, print an error message (see below), and reset cin such that it will again accept commands. (See Section 7.6 of the zyBook.) Also, your program should ignore all characters behind a number to be pushed that are on the same input line (example see below).
An example of a correct execution of this program is shown below:
stack> push 5 stack> pop 5 stack> pop error: stack is empty stack> push 6 stack> push 4bb stack> push foo error: not a number stack> list [4,6] stack> list [4,6] stack> top 4 stack> hello error: invalid command stack> end
You may want to use the compare() function (Links to an external site.) on a string to check which command has been entered.
Use of arrays, a built-in stack class, or container classes from std:: other than vector, is not allowed.
In: Computer Science
Implementing a Stack
Write a program that implements a stack of integers, and exercises the stack based on commands read from cin. To do this, write a class called Stack with exactly the following members: class Stack { public: bool isEmpty(); // returns true if stack has no elements stored int top(); // returns element from top of the stack // throws runtime_error("stack is empty") int pop(); // returns element from top of the stack and removes it // throws runtime_error("stack is empty") void push(int); // puts a new element on top of the stack private: vector elements; }; The program should read commands from cin until either end-of-file is reached or the command end is entered. (You can manually test for end-of-file by entering CTRL-D.) Each time the program expects a new command it should first print a prompt: "stack> " Your program should catch all errors that happen and continue execution until the end command or end-of-file. In case the command push is read, the program should read an integer value from cin and push it onto the stack. In case top is read, the program should print the top integer of the stack to cout. In case pop is read, the program should print the top integer of the stack to cout, and remove it from the stack. In case the command list is read, the program should print all values currently on the stack, without modifying the stack. (Exact format see below.) Your program should check whether a "number" to be pushed is actually a number. If not, print an error message (see below), and reset cin such that it will again accept commands. (See Section 7.6 of the zyBook.) Also, your program should ignore all characters behind a number to be pushed that are on the same input line (example see below). An example of a correct execution of this program is shown below: stack> push 5 stack> pop 5 stack> pop error: stack is empty stack> push 6 stack> push 4bb stack> push foo error: not a number stack> list [4,6] stack> list [4,6] stack> top 4 stack> hello error: invalid command stack> end You may want to use the compare() function (Links to an external site.) on a string to check which command has been entered. Use of arrays, a built-in stack class, or container classes from std:: other than vector, is not allowed.
In: Computer Science
The last dividend on Spirex Corporation's common stock was $5.94, and the expected growth rate is 10 percent. If you require a rate of return of 29.7 percent, what is the highest price you should be willing to pay for this stock?
In: Finance
Stoics like Seneca believed that the pursuit of virtue and practice of reason are the highest goods, and that men must accept their lots in life without undue displays of emotion or complaint. How does this letter reflect a Stoic outlook?
In: Economics
((5.11x10^3))((1.880x10^-2))((2.92x10^5)) / ((9.5x10^-7))((7.64x10^2))
Record your answer in scientific notation with 2 significant digits. Note: Your answer is assumed to be reduced to the highest power possible.
In: Chemistry
In: Physics
a laser beam passes through a diffraction grating and the second- order bright spot is produced at an angle of 22.0 degree from the main central axis. What is the highest order bright spot that can be produced by this arrangement?
In: Physics
Indicate, from the following, which has the second-highest predicted entropy at 298.15 K.
1.0 mol HCN
0.23g of HCN
0.5 mol HCN
15.0 kg HCN
All of these have the same entropy
In: Other