Computers and Technology

Do the following in introductory-level java also post screen shotsa gameto pass the time during long voyages, viking sailors would play the two-player game of havsta. in this assignment, you'll implement the game, but play will be against the computer. during each round, players choose a move, which may be either applaro, svartrå, tunholmen, or godafton. the rules are: applaro beats svartrå and tunholmensvartrå beats tunholmentunholmen beats godaftongodafton beats applaro and svartråthe computer wins in the event of a tie. your program should behave as follows: the rules should be printed to the screenthe user is asked if they'd like to play a roundif they choose 'y', a round is playedif they choose 'n', the program endsuntil the user has chosen to quit, another round is played. in a round of play: the user is asked to enter a move, which may be either svartrå, tunholmen, äpplaro, or godafton. the program should continue to prompt the user until a valid move is entered. the computer makes a move at random. (hint: remember how we generated random numbers in class.)the program prints the computer's move, the user's move, and who is the winner of this round. the user is asked if they'd like to continue. when the user has decided to quit the game, the program prints the number of: rounds playedtimes the user wontimes the computer wonsuggestionsan important skill in programming is learning how to break up a big job into smaller tasks. make an outline. make sure that your outline makes sense. test it out with real input using pencil and paper. do this before you start writing code. turn some of the individual steps of your outline into functions. some obvious choices might be a function which generates the computer's move at random. another would be a function which is passed two moves and returns the winner. the goal should be that the functions make your code as readable as your english-language outline. you don't need to implement all of the functions at first. just write placeholders (we call these stubs) first and fill them in later. implement and test your stub functions. also remember to test things as you go. it's easier to find a mistake in 5 lines of code than it is to find a mistake in 500 lines of code.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:30, gg68814
1.the index finger on your right hand types the f r v 4 j u m 7 h y 6 n lo.9 j u 7 m g t 5 b 2.if you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad? 400*2*1.5 400/2*1.5 400/2/1.5 400*2*1½ 3.select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair. rest your palms on the keyboard. relax your fingers. keep your hands lower than your elbows.
Answers: 1
image
Computers and Technology, 22.06.2019 20:10, yqui8767
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 22.06.2019 22:00, lgary9462
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass. cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array. c . run this program and observe the results.
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, cristalcastro901
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
Do you know the correct answer?
Do the following in introductory-level java also post screen shotsa gameto pass the time during long...

Questions in other subjects:

Konu
English, 03.03.2020 20:52