why do I keep getting errors?
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int CHEESE_PIZZA = 11;
const int SPINACH_PIZZA = 13;
const int CHICKEN_PIZZA = 14;
cout << "Assignment 07" << endl;
cout << "Program written by Carol" << endl <<
endl;
cout << " *********** MENU ***********" << endl;
cout << setw(9) << "ITEM" << setw(20) << "PRICE" << endl;
cout << " (1) Cheese Pizza" << setw(8) << "$"
<< CHEESE_PIZZA << endl;
cout << " (2) Spinach Pizza" << setw(7) << "$"
<< SPINACH_PIZZA << endl;
cout << " (3) Chicken Pizza" << setw(7) << "$"
<< CHICKEN_PIZZA << endl;
cout << endl;
cout << "What do you want? ";
int option;
cin >> option;
cout << "How many? ";
int quantity;
cin >> quantity;
int price;
switch (option)
{
case 1:
price = CHEESE_PIZZA;
break;
case 2:
price = SPINACH_PIZZA;
break;
case 3:
price = CHICKEN_PIZZA;
break;
default:
cout << "Please select valid item from menu. ";
break;
return 1;
}
int amount = price * quantity;
cout << "Your Bill: $ " << amount << endl;
cout << endl;
return 0;
In: Computer Science
Compare the State Pattern and the Strategy Pattern. What is the main difference? Explain their uses and provide an example of where you would use the State Pattern
In: Computer Science
C++ programming
please i need all codes in this homework
Homework
1) Call foo() three times to print below.
1 2
3 4
5 6
2) Modify the calculator in lect16 as follows using argument-passing functions.
....................
// function prototypes
void show_menu();
void add(int x, int y);
void sub(int x, int y);
.............
// function definitions
void main(){
int s;
for(;;){
show_menu();
scanf(“%d”, &s);
if (s==1){
int x, y;
printf(“enter two numbers\n”);
scanf(“%d %d”, &x, &y);
add(x, y);
}else if (s==2){
...............
}
.................
}
}
void show_menu(){
printf(“1. add 2. sub 3. square 4. factor_of 5. power 6. factor 7. quit\n”);
printf(“select operation\n”);
}
void add(int x, int y){
// print x+y
int z;
z=x+y;
printf(“the sum is %d\n”, z);
}
void sub(int x, int y){
// print x-y
.........
}
void square(int x){
// print x*x
........
}
void power(int x, int y){
// print x*x*...*x (y times)
........
}
void factor_of(int x, int y){
// if x is a factor of y, print “x is a factor of y”
// otherwise “x is not a factor of y”
// for example if x=3, y=12, x is a factor of y
// because 12%3 = 0
.......
}
void factor(int x){
// display all factors of x
...................
}
In: Computer Science
Answer the following question in Java.
Create a class called Movie. Move should contain:
Two instance variables: title of type String and rating of type int. Remember to encapsulate them.
Two constructors: One that takes a tile and rating as arguments and a copy constructor.
Getter and setter methods for both instance variables.
A method called getCategory that takes no arguments and return something of type char.
Additional information about the Movie class:
Title: The instance should always store the string in all upper case, if the method is called with a string that contains any lower case characters, the lower case characters should be converted to upper case.
Rating must be a value between 0 and 10 (inclusive). If the rating provided is outside of that range, the rating should remain unchanged.
getCategory: A movie is considered A category if its rating is 9 or 10, B category if the rating is 7 or 8, C category if the rating is 5 or 6, D category if the rating is 3 or 4 and F category otherwise.
In: Computer Science
A student prepared the three solutions listed in the table using graduated pipettes. Determine the initial molarities of H2O2 in each of the 3 solutions to the correct sig figs.
| Solution | Volume of 3.0% H2O2 (mL) | Volume of DI water (mL) | Volume of pH=7 buffer (mL) | Initial molarity H2O2 |
| 1 | 18.75 | 1.25 | 2.00 | |
| 2 | 12.50 | 7.50 | 2.00 | |
| 3 | 6.25 | 13.75 | 2.00 |
In: Chemistry
Using data on a representative sample of college students, the following model was estimated: (standard errors are in parentheses) sat =1,028.1+19.3hsize − 2.2hsize2 − 45.1Female −169.8black + 62.3 female*black (6.29) (3.83) (0.53) (4.29) (12.7) (18.15) n = 4,137 and ? 2= 0.0858 The variable sat is the combined SAT score, hsize is size of the student’s high school graduating class, in hundreds, female is a gender dummy variable equal to one for females and zero otherwise, and black is a race dummy variable equal to one for blacks and zero otherwise.
3- Holding hsize fixed, what is the estimated difference in SAT score between nonblack females and nonblack males? How statistically significant is this estimated difference?
In: Economics
Adam Granger operates a kiosk in downtown Chicago, at which he sells one style of baseball hat. He buys the hats from a supplier for $16 and sells them for $22. Adam’s current breakeven point is 20,250 hats per year.
Assume that Adam’s fixed costs, variable costs, and sales price were the same last year, when he made $28,350 in net income. How many hats did Adam sell last year, assuming a 30% income tax rate? (correct answer is 27,700 - already figured out that step)
What was Adam’s margin of safety last year? Margin of Safety $_____
If Adam wants to earn $51,030 in net income, how many hats must
he sell, assuming a 30% tax rate?
# of Hats: _____
How many hats must Adam sell to break even if his supplier
raises the price of the hats to $17 per hat?
# of Hats: _____
Adam has decided to increase his sales price to $23 to offset
the supplier’s price increase. He believes that the increase will
result in a 5% reduction from last year’s sales volume. What is
Adam’s expected net income, assuming a 30% tax rate?
Net Income: $_______
In: Accounting
5. Suppose that in a city of 10,000 people, there are 4,000 who like football and 6,000 who do not. Suppose that we conduct a poll of 16 citizens. What is the probability that at least half of those polled like football? (Use Binomial approximation to find a decimal answer.) 1
6. Suppose that a random variable X is an Exponential Random Variable with parameter β = 3. (a) What is E(X)? (b) Compute P(X > 2). (c) Compute P(X > 5 | X > 3).
In: Math
Suppose there is an individual with “well behaved preferences” who consumes bundles of two goods, (X,Y) and this individual is indifferent between bundle 1, (15,3) and bundle 2, (6,12). There is also bundle 3, (10.5, 7.5).
a) List and briefly define the 5 assumptions that define “Well behaved preferences”
b) Between bundles 1 and 3, does the consumer prefer one bundle over the other, or is he indifferent? What about between 2 and 3? Justify your answer mathematically.
In: Economics
In: Physics
Phosphoric acid is a triprotic acid, so H3PO4, H2PO4 -, and HPO4 2- are all acids. Which of the solutions below would have the lowest pH?
0.1 M NaH2PO4
0.1 M Na2HPO4
0.1 M Na3PO4
In: Chemistry
An ideal spring is lying horizontally on a frictionless surface. One end of the spring is attached to a wall. The other end is attached to a moveable block that has a mass of 5 kg. The block is pulled so that the spring stretches from its equilibrium position by 0.65 m. Then the block is released (from rest), and as a result the system oscillates with a frequency of 0.40 Hz (that's 0.40 rev/sec) Find:
Show all your steps
a) The acceleratiuon of the block when the spring is stretched by 0.28 m.
b) the maximum force magnitude exerted by the spring on the block.
c)the oscillation frequency of a 2.5 kg blcok under the same circumstances (i.e. with the same spring and initial displacement).
In: Physics
Why does an ETO operation consider product and process design as a production activity? How does it complicate the production planning and control process?
In: Operations Management
What is the function for printVector that takes a vector of ints, and prints the values one after the other to screen, with commas in between the values.
For example,
vector<int> numbers{0,3,9};
printVector(numbers);
...should print out:
0,3,9
In: Computer Science
virial equation. Then, calculate V at similar temperature and 75 bar.
In: Other