1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program must display the current score to the player. 8. The game ends only when the player decides to quit. If the game ends with 10 or more points, the player wins, and your program must congratulate them. Otherwise, it must thank the user for playing before terminating the game. 9. Note: users are always allowed to enter any type of data when asked for input. Your program must always verify the user input. Invalid input should be handled with suitable error messages and the prompt should be repeated. To keep things simple, we will consider that when prompted a user enters either an integer or a string (i.e., you do not need to check for other data types). Also note that user inputs that are of type strings are not case-sensitive (i.e., it can be any combination of lowercase and uppercase letters).

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Question
1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program must display the current score to the player. 8. The game ends only when the player decides to quit. If the game ends with 10 or more points, the player wins, and your program must congratulate them. Otherwise, it must thank the user for playing before terminating the game. 9. Note: users are always allowed to enter any type of data when asked for input. Your program must always verify the user input. Invalid input should be handled with suitable error messages and the prompt should be repeated. To keep things simple, we will consider that when prompted a user enters either an integer or a string (i.e., you do not need to check for other data types). Also note that user inputs that are of type strings are not case-sensitive (i.e., it can be any combination of lowercase and uppercase letters).
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

this code only prints random dna letters where is the game there are the questions below

Find the complement of a DNA strand: recall that a DNA strand is a combination of four
uppercase letters; A, T, C, and G. The letters A and T are complements, and the letters C
and G are complements. To find the complement of a DNA strand you must replace each
character with its complement. For example, ATCGG is the complement of TAGCC and
CCC is the complement of GGG. Your program must show a DNA of a predefined length
to the player and ask for its complement.
2. Find the reversed DNA strand: the order of the characters in a DNA strand should be
reversed. Examples: GCTAA is the reverse of AATCG and AA is the reverse of AA. Your
program must show a DNA of a predefined length to the player and ask for the reversed
strand.
3. Find the compressed DNA strand: all repeated characters in a DNA strand should be
replaced by the number of repeats followed by that character once. For example, 2C3AT
is the compressed form of CCAAAT, G2TA3GC is the compressed form of GTTAGGGC, and
 
 
Assignment # 2 Due: Oct 17th, 11:59 PM
Page 6 of 11
TAGC is the compressed form of TAGC. Your program must show a DNA of a predefined
length to the player and ask for its compressed form.
4. Find the expanded DNA strand: this is the opposite of the compression technique
described in 3. So, it basically undoes the compressing. For example, CAGGTTT is the
expanded form of CA2G3T, TATTGC is the expanded form of TA2TGC, and TAGC is the
expanded form of TAGC. Your program must show a compressed DNA to the player and
ask for its expanded form. The expanded DNA must have the predefined length (n).
 
i was started but got only this far
import string
import random
from random import choice
from random import choice

print("Welcome to the DNA quiz game!")
u=input("Enter your username: ")
count=int(input("Hi " + u + ", please enter a positive integer for the DNA length: "))
print()
from random import choice
def String(length):

   DNA=""
   for count in range(length):
      DNA+=choice("CGTA")
      return DNA
print("Select an option [1-4] to answer a question or 5 to quit the game.")
print( "Win the game by scoring at least 10 points! ")
print(" 1. Complement [2 points]   2. Reverse [2 points]   3. Compress [3 point]   4. Expand [3 points]   5. Quit")
y=int(input())
while y==5:
    break
while 1<=y<=4:
    if y==1:
        pass

while y<1 or y>5:
    y=int(input("Please enter a digit between [1-5]: "))


Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,