I will need to submit: A copy of the Module 4 lab document with answers for the self-test exercises as specified on the lab document. Name this document “yourlastnameSelfTest4” Your completed...

1 answer below »


I will need to submit:





  • A copy of the Module 4 lab document with answers for the self-test exercises as specified on the lab document. Name this document “yourlastnameSelfTest4”







  • Your completed algorithm based on the “RPSAlgorithm” document that I have provided in your module 4 download. Youmustuse this algorithm. Name this document “yourlastnameRPSAlgorithm.docx”




  • The source code for the Rock Paper Scissor program– Name this file “yourlastnameRPS.cpp




  • TEST RUN - Copy the test run output from your program and paste in to the bottom of your source code. Make each line a comment so that all you need to do is submit your source code and your output will be at the bottom of your program.






Rock, Paper, Scissors


Write a program to play and score the paper-rock-scissor game. Each of two users types in either P, R, or S. The program then announces the winner as well the basis for determining the winner: Paper covers rock, Rock breaks scissors, Scissors cut paper, or Nobody wins.


Be sure to allow the users to use lowercase as well uppercase letters. Your program should include a loop that lets the user play again until the user says she or he is done.



Test Run: Refer to the lab sheet




CSC121Module4Fall2021Student/~$C121Module4LabSpring2021.docx CSC121Module4Fall2021Student/Chapter03/03-04.cpp CSC121Module4Fall2021Student/Chapter03/03-04.cpp //DISPLAY 3.4 The Importance of Braces //Illustrates the importance of using braces in if-else statements. #include "stdafx.h" #include  using namespace std; int main( ) {     double fuelGaugeReading;     //cout < 4 * (15 >< endl;>< "enter fuel gauge reading: ";     cin ="">> fuelGaugeReading;     cout < "first with braces:\n";>< 0.75)     {="">< 0.25)>< "fuel very low. caution!\n";     }=""     else=""     ="">< "fuel over 3 4. dont stop now!\n";=""     ="">< "now without braces:\n";>< 0.75)>< 0.25)>< "fuel very low. caution!\n";     else="">< "fuel over 3 4. don't stop now!\n";*/=""     return 0;="" }="" csc121module4fall2021student/chapter03/03-05.cpp="" csc121module4fall2021student/chapter03/03-05.cpp="" display 3.5 multiway if-else statement="" program to compute state income tax.="" #include "stdafx.h"=""> using namespace std; //This program outputs the amount of state income tax due computed //as follows: no tax on income up to $15,000; 5% on income between //$15,001 and $25,000; 10% on income over $25,000. int main( ) {     int netIncome;     double taxBill;     double fivePercentTax, tenPercentTax;     cout < "enter net income (rounded to whole dollars) $";     cin ="">> netIncome;     if (netIncome <= 15000)         taxbill =" 0;"     else if ((netincome =""> 15000) && (netIncome <= 25000))         //5% of amount over $15,000=""         taxbill =" (0.05*(netIncome - 15000));"     else //netincome =""> $25,000     {         //fivePercentTax = 5% of income from $15,000 to $25,000.         fivePercentTax = 0.05*10000;         //tenPercentTax = 10% of income over $25,000.         tenPercentTax = 0.10*(netIncome - 25000);         taxBill = (fivePercentTax + tenPercentTax);     }     cout.setf(ios::fixed);     cout.setf(ios::showpoint);     cout.precision(2);     cout <><>< endl><><>< endl;     return 0;="" }="" csc121module4fall2021student/chapter03/03-06.cpp="" csc121module4fall2021student/chapter03/03-06.cpp="" display 3.6 a switch statement="" program to illustrate the switch statement.=""> using namespace std; int main( ) {     char grade, choice = 'Y';     do {         cout < "enter your midterm grade and press return: ";         cin ="">> grade;         switch (toupper(grade))         {//begin switch construct         case 'A':             cout < "excellent. ">< "you need not take the final.\n";             //break;=""         case 'b':="">< "very good. ";             grade =" 'B';">< "your midterm grade is now "><>< endl;             //break;=""         case 'c':="">< "passing.\n";             //break;=""         case 'd':=""         case 'f':="">< "not good. ">< "go study.\n";            // break;=""         default:="">< "that is not a possible grade.\n";         }//end switch="">< "do another? ";         cin ="">> (choice);     } while (toupper(choice) == 'Y');     cout < "end of program.\n";     return 0;="" }="" ternary operator=""> //#include  //using namespace std; // //int main() { // //    int first, second; // //    cout <>< endl;><><>< ": ";     cin ="">> first; // //    cout <><>< ": ";     cin ="">> second; // //    string message = first > second ? "first is greater than second" : "first is less than or equal to second"; // //    cout <>< endl;     return 0;="" }="" csc121module4fall2021student/chapter03/03-07.cpp="" csc121module4fall2021student/chapter03/03-07.cpp="" display 3.7 a menu="" program to give out homework assignment information.="" #include "stdafx.h"=""> //using namespace std; //int main( ) //{ //    int choice; // //    do //    { //        cout < endl>< "choose 1 to see the next homework assignment.\n">< "choose 2 for your grade on the last assignment.\n">< "choose 3 for assignment hints.\n">< "choose 4 to exit this program.\n">< "enter your choice and press return: ";         cin ="">> choice; // //        switch (choice) //        { //            case 1: //               //code to display the next assignment on screen would go here. //                break; //            case 2: //               //code to ask for a student number and give the corresponding //               //grade would go here. //                break; //            case 3: //               //code to display a hint for the current assignment would go //               //here. //                break; //            case 4: //                cout < "end of program.\n";                 break;=""             default:="">< "not a valid choice.\n">< "choose again.\n";         }=""     } while (choice !=" 4);"     return 0;="" }="" csc121module4fall2021student/chapter03/03-08.cpp="" csc121module4fall2021student/chapter03/03-08.cpp="" display 3.8 block with a local variable="" program to compute bill for either a wholesale or a retail purchase.=""> using namespace std; const double TAX_RATE = 0.05; //5% sales tax. int main( ) {//begin main     char saleType;     int number;     double price, total;     cout < "enter price $";     cin ="">> price;     cout < "enter number purchased: ";     cin ="">> number;     cout < "type w if this is a wholesale purchase.\n">< "type r if this is a retail purchase.\n">< "then press return.\n";     cin ="">> saleType;     if ((saleType == 'W' ||  'w'))     {         total = price * number;     }     else if ((saleType == 'R') || (saleType == 'r'))     {         double subtotal;         subtotal = price * number;         total = subtotal + subtotal * TAX_RATE;     }     else     {         cout < "error in input.\n";     }="">< subtotal;       cout.setf(ios::fixed);=""     cout.setf(ios::showpoint);=""     cout.precision(2);=""><><><>< endl;><>< total;     if ((saletype ="= 'R') || (saleType == 'r'))">< " including sales tax.\n";     return 0;="" }="" csc121module4fall2021student/chapter03/03-10.cpp="" csc121module4fall2021student/chapter03/03-10.cpp="" display 3.10 the increment operator as an expression="" calorie-counting program.="" #include "stdafx.h"=""> using namespace std; int main( ) {     int numberOfItems, count,         caloriesForItem, totalCalories;     cout < "how many items did you eat today? ";     cin ="">> numberOfItems;     totalCalories = 0;     count = 1;     cout < "enter the number of calories in each of the\n"><>< " items eaten:\n";><= numberofitems)     {=""         cin ="">> caloriesForItem;         totalCalories = totalCalories                          + caloriesForItem;     }     cout < "total calories eaten today = "><>< endl;     return 0;="" }="" csc121module4fall2021student/chapter03/03-12.cpp="" csc121module4fall2021student/chapter03/03-12.cpp="" display 3.12 a for statement="" illustrates a for loop.="" #include "stdafx.h"=""> using namespace std; int main( ) {     int sum = 0;     int n = 1;     for (  n = 1; n <= 10; ++n)   note that the variable n is a local=""         sum =" sum + n;             //variable of the body of the for loop!"     n--;// adjust n to last value added in="">< "the sum of the numbers 1 to 10 is "><>< endl;><>< endl;     return 0;="" }="" csc121module4fall2021student/chapter03/03-14.cpp="" csc121module4fall2021student/chapter03/03-14.cpp="" display 3.14 a break statement in a loop="" sums a list of ten negative numbers.="" #include "stdafx.h"=""> using namespace std; int main( ) {     int number, sum = 0, count = 0;     cout < "enter 10 negative numbers:\n";><= 10)     {=""         cin ="">> number;                 /* if (number >= 0)         {             cout < "error: positive number">< " or zero was entered as the\n"><>< "th number! input ends "><><>< "th number.\n"><>< "th number was not added in.\n";             break;=""         }=""         sum =" sum + number;*/"         if (number ="">= 0)         {             cout < "error: positive number">< " or zero was entered as the\n"><>< "th number! input ends "><><>< "th number.\n"><>< "th number was not added in.\n";             count--;=""             //break;=""         }=""         else=""             sum =" sum + number;"     }=""><>< " is the sum of the first "><>< " numbers.\n";     return 0;="" }="" csc121module4fall2021student/chapter03/03-15.cpp="" csc121module4fall2021student/chapter03/03-15.cpp="" display 3.15 explicitly nested loops="" determines the total number of green-necked vulture eggs="" counted by all conservationists in the conservation district.=""> using namespace std; int main() {//begin main cout < "this program tallies conservationist reports\n">< "on the green-necked vulture.\n">< "each conservationist's report consists of\n">< "a list of numbers. each number is the count of\n">< "the eggs observed in one ">< "green-necked vulture nest.\n">< "this program then tallies ">< "the total number of eggs.\n";     int numberofreports;="">< "how many conservationist reports are there? ";     cin ="">> numberOfReports;     int grantTotal = 0, subtotal, count;     //counter controlled loop     for (count = 1; count <= numberofreports; count++) outer loop controls the number of reports=""     {//begin for loop=""><>< "enter the report of "><><>< endl;>< "enter the number of eggs in each nest.\n">< "place a negative integer at the end of your list.\n";         subtotal =" 0;//sets the subtotal back to zero for the next report"         int next;=""         cin ="">> next;//priming read for inner loop control variable         while (next >=0)//inner sentinal controlled loop accumulates eggs for one report         {//begin while             subtotal = subtotal + next; //accumulator for each individual conservationist             cin >> next;         }//end while         cout < "total egg count for conservationist "><><>< " is "><>< endl;         granttotal =" grantTotal + subtotal;//accumulator for total of all eggs counted"     }//end for loop=""><>< "total egg count for all reports = "><>< endl;     return 0;="" }//end main="" this program tallies conservationist reports="" on the green - necked vulture.="" each conservationist's report consists of="" a list of numbers.each number is the count of="" the eggs observed in one green - necked vulture nest.="" this program then tallies the total number of eggs.="" how many conservationist reports are there ? 3="" enter the report of conservationist number 1="" enter the number of eggs in each nest.="" place a negative integer at the end of your list.="" 2="" 1="" 0="" - 1="" total egg count for conservationist  number 1 is 3="" enter the report of conservationist number 2="" enter the number of eggs in each nest.="" place a negative integer at the end of your list.="" 2="" 2="" - 1="" total egg count for conservationist  number 2 is 4="" enter the report of conservationist number 3="" enter the number of eggs in each nest.="" place a negative integer at the end of your list.="" 2="" - 1="" total egg count for conservationist  number 3 is 2="" total egg count for all reports =" 9" csc121module4fall2021student/csc121module4labfall2021.docx="" csc121="" lab="" 4:="" boolean="" expressions="" and="" multiway="" if…else="" name="" any="" items="" that="" require="" a="" written="" answer="" should="" be="" answered="" on="" a="" separate="" page="" as="" a="" part="" of="" this="" document.="" items="" in="" bold="" (exercises="" 6="" and="" 12)="" require="" that="" the="" source="" code="" for="" your="" test="" program="" be="" included="" in="" your="" answer.="" part="" 1="" complete="" the="" following="" self-test="" exercises="" (test="" each="" exercise="" with="" a="" small="" program="" that="" will="" allow="" the="" user="" to="" enter="" the="" data="" being="" tested="" as="" often="" as="" the="" user="" wishes):="" ·="" page="" 118="" #="" 1="" ·="" page="" 127="" #="" 5="" ·="" page="" 127="" #="" 6="" ·="" page="" 127="" #="" 9="" ·="" page="" 128="" #="" 11="" ·="" page="" 128="" #="" 12="" ·="" page="" 128="" #="" 13="" ·="" page="" 128="" #="" 14="" part="" 2="" write="" a="" program="" to="" play="" and="" score="" the="" paper-rock-scissor="" game.="" each="" of="" two="" users="" types="" in="" either="" p,="" r,="" or="" s.="" the="" program="" then="" announces="" the="" winner="" as="" well="" the="" basis="" for="" determining="" the="" winner:="" paper="" covers="" rock,="" rock="" breaks="" scissors,="" scissors="" cut="" paper,="" or="" nobody="" wins.="" be="" sure="" to="" allow="" the="" users="" to="" use="" lowercase="" as="" well="" uppercase="" letters.="" your="" program="" should="" include="" a="" loop="" that="" lets="" the="" user="" play="" again="" until="" the="" user="" says="" she="" or="" he="" is="" done.="" test="" your="" program="" using="" the="" data="" in="" the="" following="" test="" run.="" test="" run:="" player="" 1="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" r="" player="" 2="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" s="" player="" 1="" wins!="" rock="" breaks="" scissors!="" total="" wins="" player1="" 1="" total="" wins="" player2="" 0="" do="" you="" wish="" to="" play="" again?="" please="" answer="" y="" or="" n.="" y="" player="" 1="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" r="" player="" 2="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" r="" nobody="" wins!="" tie!="" total="" wins="" player1="" 1="" total="" wins="" player2="" 0="" do="" you="" wish="" to="" play="" again?="" please="" answer="" y="" or="" n.="" y="" player="" 1="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" s="" player="" 2="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" r="" player="" 2="" wins!="" rock="" breaks="" scissors!="" total="" wins="" player1="" 1="" total="" wins="" player2="" 1="" do="" you="" wish="" to="" play="" again?="" please="" answer="" y="" or="" n.="" y="" player="" 1="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" p="" player="" 2="" please="" enter="" either="" r)ock,="" p)aper,="" or="" s)cissors.="" r="" player="" 1="" wins!="" paper="" covers="" rock!="" total="" wins="" player1="" 2="" total="" wins="" player2="" 1="" do="" you="" wish="" to="" play="" again?="" please="" answer="" y="" or="" n.="" n="" press="" any="" key="" to="" continue="" .="" .="" .="" you="" will="" need="" to="" submit:="" ·="" a="" copy="" of="" this="" document="" with="" answers="" as="" specified="" above,="" for="" the="" self-test="" exercises.="" name="" this="" document="" “yourlastnameselftest4”="" ·="" your="" completed="" algorithm="" based="" on="" the="" “rpsalgorithm”="" document="" that="" i="" have="" provided="" in="" your="" module="" 4="" download.="" you="" must="" use="" this="" algorithm.="" name="" this="" document="" “yourlastnamerpsalgorithm.docx”="" ·="" the="" source="" code="" for="" the="" rock="" paper="" scissor="" program="" which="" must="" be="" based="" on="" your="" rps="" algorithm="" –="" name="" this="" file="" “yourlastnamerps.cpp ="" ·="" test="" run="" -="" copy="" the="" test="" run="" output="" from="" your="" program="" and="" paste="" in="" to="" the="" bottom="" of="" your="" source="" code.="" make="" each="" line="" a="" comment="" so="" that="" all="" you="" need="" to="" do="" is="" submit="" your="" source="" code="" and="" your="" output="" will="" be="" at="" the="" bottom="" of="" your="" program. ="" csc121module4fall2021student/rpsalgorithm.docx="" just="" a="" word="" on="" algorithm="" design="" you="" cannot="" write="" a="" program="" to="" solve="" a="" problem="" unless="" you="" first="" understand="" the="" problem="" and="" then="" design="" a="" logical="" set="" of="" instructions="" to="" solve="" the="" problem.="" designing="" an="" algorithm="" is="" a="" skill="" that="" may="" take="" some="" time="" to="" develop.="" for="" the="" module="" 4="" lab="" i="" am="" giving="" you="" an="" algorithm="" based="" on="" the="" problem="" statement.="" take="" some="" time="" to="" see="" how="" the="" “pseudocode”="" that="" i="" have="" provided="" was="" derived="" from="" the="" problem="" statement.="" this="" will="" be="" the="" approach="" you="" will="" need="" to="" take="" for="" future="" program="" assignments.="" the="" algorithm="" is="" essentially="" the="" solution="" to="" the="" problem.="" this="" algorithm="" is="" a="" possible="" solution,="" certainly="" not="" the="" only="" solution.="" use="" this="" algorithm="" so="" that="" you="" understand="" the="" process.="" if="" you="" do="" a="" good="" job="" in="" developing="" the="" algorithm,="" then="" all="" you="" need="" to="" do="" is="" translate="" that="" algorithm="" into="" c++="" code.="" use="" statements="" in="" your="" algorithm="" as="" comments="" in="" your="" program.="" resist="" the="" urge="" to="" code!!!="" at="" some="" point="" in="" the="" very="" near="" future,="" i="" will="" simply="" give="" you="" the="" problem="" statement,="" and="" it="" will="" be="" up="" to="" you="" to="" design="" the="" algorithm.="" algorithm="" for="" rock="" paper="" scissors="" program="" based="" on="" the="" problem="" specification.="" decide="" what="" memory="" (variables)="" will="" be="" needed="" char="" p1choice,="" p2choice,="" char="" playagain="" int="" winner,="" message,="" p1count,="" p2count="" do="" while="" the="" user="" wishes="" to="" play="" again="" get="" player="" 1’s="" choice.="" get="" player="" 2’a="" choice.="" determine="" the="" winner="" if="" p1’s="" choice="" is="" ‘r’="" and="" p2’s="" choice="" is="" ‘s’="" then="" p1="" is="" the="" winner="" if="" p1’s="" choice="" is="" ‘p’="" and="" p2’s="" choice="" is="" ‘r’="" then="" p1="" is="" the="" winner="" for="" you="" to="" complete="" .="" .="" determine="" the="" message="" if="" p1="" is="" ‘r’="" and="" p2="" is="" ‘s’="" or="" p2="" is="" ‘r’="" and="" p1="" is="" ‘s’="" output="" “rock="" breaks="" scissors”="" if="" for="" you="" to="" complete="" .="" .="" if="" the="" winner="" is="" p1="" add="" one="" to="" p1’s="" count="" and="" print="" that="" p1="" is="" the="" winner="" else="" if="" the="" winner="" is="" p2="" add="" one="" to="" p2’s="" count="" and="" print="" that="" p2="" is="" the="" winner="" else="" print="" that="" it="" was="" a="" tie.="" print="" the="" total="" wins="" so="" far="" for="" each="" player="" .="" output="" –="" refer="" to="" the="" lab="" sheet="" for="" test="" run="" csc121module4fall2021student/savitch_ch_03.ppt="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" *="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" chapter="" 3="" more="" flow="" of="" control="" *="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" control="" structures="" slide="" 1-="" *="" sequence="" –="" instructions="" executed="" in="" the="" order="" in="" which="" they="" appear="" selection="" -="" a="" sequence="" of="" statements="" is="" executed="" depending="" on="" whether="" or="" not="" a="" condition="" it="" true="" or="" false.="" this="" means="" the="" program="" chooses="" between="" two="" or="" more="" alternative="" paths.="" iteration="" -="" repeatedly="" executes="" a="" series="" of="" statements="" as="" long="" as="" the="" condition="" is="" true. ="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" overview="" 3.1="" using="" boolean="" expressions="" 3.2="" multiway="" branches="" 3.3="" more="" about="" c++="" loop="" statements="" 3.4="" designing="" loops="" slide="" 3-="" *="" *="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" flow="" of="" control="" flow="" of="" control="" refers="" to="" the="" order="" in="" which="" program="" statements="" are="" performed="" we="" have="" seen="" the="" following="" ways="" to="" specify="" flow="" of="" control="" if-else-statements="" while-statements="" do-while-statements="" new="" methods="" described="" in="" this="" chapter="" include="" switch-statements="" for-statements="" slide="" 3-="" *="" *="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" 3.1="" using="" boolean="" expressions="" *="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" increment="" and="" decrement="" (++,="" --)="" the="" increment="" operator="" (++)="" and="" the="" decrement="" operator="" (--)="" increase="" or="" reduce="" by="" one="" the="" value="" stored="" in="" a="" variable.="" the="" operator="" can="" be="" used="" both="" as="" a="" prefix="" and="" as="" a="" suffix.="" that="" means="" that="" it="" can="" be="" written="" either="" before="" the="" variable="" name="" (++x)="" or="" after="" it="" (x++).="" in="" simple="" expressions="" like="" x++="" or="" ++x,="" both="" have="" exactly="" the="" same="" meaning;="" in="" other="" expressions="" in="" which="" the="" result="" of="" the="" increment="" or="" decrement="" operation="" is="" evaluated,="" they="" may="" have="" an="" important="" difference="" in="" their="" meaning:="" slide="" 1-="" *="" example="" 1="" -="" preincrement="" example="" 2="" -="" postincrement="" x="3;" y="++x;" x="" contains="" 4,="" y="" contains="" 4="" x="3;" y="x++;" x="" contains="" 4,="" y="" contains="" 3="" copyright="" ©="" 2018="" pearson="" addison-wesley.="" all="" rights="" reserved.="" using="" boolean="" expressions="" a="" boolean="" expression="" is="" an="" expression="" that="" is="" either="" true="" or="" false="" boolean="" expressions="" are="" evaluated="" using="" relational="" operations="" such="" as="=" ,="">< ,="" and="">= which produce a boolean value and boolean operations such as &&, | |, and ! which also produce a boolean value
Answered Same DaySep 29, 2021

Answer To: I will need to submit: A copy of the Module 4 lab document with answers for the self-test exercises...

Amar Kumar answered on Sep 29 2021
132 Votes
#import the library function "random" so that you can use it for computer
#choice
import random
#de
fine main
def main():
#assign win, lose, and tie to zero for tallying
win = 0
lose = 0
tie = 0
#control loop with 'y' variable
play_again = 'y'
#start the game
while play_again == 'y':
#make a welcome message and give directions
print('Prepare to battle in a game of paper, rock, scissors!')
print('Please input the correct number according')
print('to the object you want to choose.')
#Get the player and computers choices and
#assign them to variables
computer_choice = get_computer_choice()
player_choice = get_player_choice()
#print choices
print('Computer chose', computer_choice, '.')
print('You chose', player_choice, '.')
#determine who won
winner_result(computer_choice, player_choice)
#ask the user if they want to play again
play_again =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here