//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 choice1; char choice2; char playagain; char n; char N; bool keepgoing = true; while (keepgoing){ cout<< "Player 1 enter choice r, p, or s \n"; cin>> choice1; cout<< "Player 2 enter a choice r, p, or s \n"; cin>> choice2; switch(choice1){ case 'p': case 'P': switch(choice2){ case 'r': case 'R': cout<< "Paper covers rock! player 1 wins \n"; break; case 'p': case 'P': cout<< "Its a draw! No one wins \n"; break; case 'S': case 's': cout<< "Scissors cut paper! player 2 wins \n"; break; default: cout<< "Player two entered an invalid input! Player 1 wins \n"; break; } } switch(choice1){ case 'R': case 'r': switch(choice2){ case 'r': case 'R': cout << "Rock ties rock! nobody wins \n"; break; case 'p': case 'P': cout << "paper covers rock! player2 wins \n"; break; case 's': case 'S': cout << "rock crushes scissors. player1 wins \n"; break; default: cout << "Player 2 entered invalid input. player 1 wins by default \n"; break; } } switch (choice1){ case 'S': case 's': switch (choice2){ case 'r': case 'R': cout<< "Rock smahsed scisscors! Player 2 wins \n"; break; case 'p': case 'P': cout<< "Scissors cut paper! Player 1 wins \n"; break; case 's': case 'S': cout<< "Its a draw"; break; default: cout<<"Player 2 entered an invalid input. Player 1 wins \n"; break; } } cout<< "Would you like to play again \n"; cin>> playagain; if((playagain=='n')||(playagain=='N')) keepgoing=false; } } // 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 " <