Menu

(Solved) : Part 1 Design Algorithm Prompt User Numerical Value Two Cards Program Receive Two Numbers Q33298260 . . .

Part 1: Design an algorithm that will prompt the user for thenumerical value of two cards. The program will receive the twonumbers and display their sum on the screen. If the calculated sumis 21, an asterisk is to be displayed beside the sum. The programshall end when two zeros are entered. The program shall print awelcome message when it is first started and a goodbye message whenit terminates.

Part 2: Modify the algorithm to allow the user to enter the facecards as J, Q, K or A. If the user enters J, Q, or K then convertthe entered value to 10. If the user enters A then count the valueas 11 points.

Part 3: Modify the algorithm to allow the user who receives theA to designate it either as 1 or 11.

Deliverables: For each part 1, 2, and 3 you are to turn in botha flowchart and the pseudocode required to write the program in anylanguage.

Add comments to each line of the code and make clear flowchart + psuedocode for all 3 partsdef cardValue(c): if c.upper() in ‘JQK’: return 10 if c.upper() == ‘A’: while True: choice = input(‘Enter 1 for considering Ace as 11, 2 for considering it as 1: ‘) if choice == ‘1’: return 11 elif choice == ‘2’: return 12 else: print(‘Incorrect choice’) return int(c)print(‘Starting the cards value sum code:n’)while True: x = cardValue(input(‘Enter numeric value of card1: ‘)) y = cardValue(input(‘Enter numeric value of card2: ‘)) if x==0 and y==0: print(‘Goodbye! Exiting now!’) break s = x + y if s == 21: print(‘Sum: %d*’ % s) else: print(‘Sum:’, s) print()

Expert Answer


Answer to Part 1 Design Algorithm Prompt User Numerical Value Two Cards Program Receive Two Numbers Q33298260 . . .

OR