//homework 1 //Joe DeVito // Page 171 #'s 1,5,10 //2/18/08 #include "stdafx.h" #include using namespace std; int main () { //Problem 1 { char choice_1; char choice_2; char playagain; char Y; char y; char r=1; char p=3; char s= 5; char R=1; char P= 3; char S= 5; int rockwins= 6; int paperwins= 4; int swins= 8; cout<< "Player 1 enter choice r, p, or s \n"; cin>> choice_1; cout<< "Player 2 enter a choice r, p, or s \n"; cin>> choice_2; switch (choice_1) { case 'p': case 'P': if ((choice_1 + choice_2) == paperwins) cout<< "Paper wins! Paper covers rock! \n"; case 'R': case 'r': if ((choice_1 + choice_2) == rockwins) cout<< "Rock wins! Rock smashes scissors \n"; case 'S': case 's': if ((choice_1 + choice_2) == swins) cout<<"Scissors wins! Scissors cut paper \n"; else cout<< "No one wins \n"; cout<< "Would you like to play again \n"; cin>> playagain; } } // Problem 5 { int Mo, Tu, We, Th, Fr, Sa, Su; double minutes; char day; double time; double daytime; double day_time_charge; double total_day_time; double night_time_charge; double total_night_time; double total_weekend; Mo = 1; Tu = 1; We = 1; Th = 1; Fr = 1; Sa = 2; Su = 2; cout<< "Please enter the day that the call is being made \n"; cin>> day; cout<< "Please enter the time that the call is made on the 24 hour scale \n"; cin>> time; cout << "Please enter how long the call was, rounded to the closest minute \n"; cin>> minutes; day_time_charge = .40; total_day_time = (minutes * day_time_charge); night_time_charge = .25; total_night_time = (minutes * night_time_charge); total_weekend = (minutes * .15); if ((time >=8) && (time <=18) && (day == 1)) cout<< "The total cost is "<< total_day_time; if ((time<= 8) && (time >=18) && (day ==1)) cout<< "The total cost is " <