Question

In: Computer Science

PSEUDOCODE: 1. You are designing software for a voting booth. Please create pseudocode for a modular...

PSEUDOCODE:

1. You are designing software for a voting booth. Please create pseudocode for a modular program that:

  • - Takes in a user inputted integer for age. If their age is below 18, display "you are too young to vote"

  • - Only If their age is high enough, please ask them which candidate they wish to vote for. Valid options are "dog", "cat", "horse"

  • - If they did not choose a valid option display "you did not choose a valid option"

  • - If they were old enough and chose a valid option display
    "You voted for <name>" where name represents the candidate they chose

    You may create modules / functions as you please but there must be at least 2 modules or functions and they must be meaningful. You can not just group arbitrary statements to gether.

    Make sure to test our your solution on your own by plugging values in before submitting the pseudocode for the program.

    2. Define a function in pseudocode named 'passwordChecker'that has one String parameter named password and returns True if the password was 'batman' or 'robin' and False if the password was anything else. You do not need to display anything or create any modules. Just simply a function definition.

Solutions

Expert Solution

1)

Pseudocode : Voting booth

BEGIN

NUMBER age

STRING vote

INPUT age

IF agechecker(age) THEN

                INPUT vote

display(vote)

END IF

END

MODULE agechecker(age)

BEGIN

                                IF age>=18 THEN

                                                Print “Please Select a valid option”

                                                return true

                                ELSE

                                                Print “You are too young to vote”

                                                return false

                                END IF

END

MODULE display(vote)

BEGIN

                                IF vote==”dog” OR vote==”cat” OR   vote==”horse”

                                                Print “You voted for”, vote

                                ELSE

                                                Print "you did not choose a valid option"          

END IF

END

2) Since only the function defintion is asked and it is really not clear if 1 and 2 are seperate I will assume that both are seperate

passwordchecker(pass)

BEGIN

IF pass=="batman" or pass=="robin"

return True

ELSE

return False

END IF

END


Related Solutions

(I AM IN A INTRO TO PROGRAMMING, PLEASE USE SIMPLE PSEUDOCODE IF POSSIBLE) Create pseudocode for...
(I AM IN A INTRO TO PROGRAMMING, PLEASE USE SIMPLE PSEUDOCODE IF POSSIBLE) Create pseudocode for a program for Hansel's Housecleaning Service. The program prompts the user for a customer's last name only. While the last name is not “zzz” your program will ask for the number of bathrooms and the number of other rooms to be cleaned and display the cleaning charge. You should use a sentinel-controlled while loop in your main loop logic. A customer name of “zzz”...
PSEUDOCODE: 1. You are designing a 2 dimensional game where players shoot ​bullets​ hugs at each...
PSEUDOCODE: 1. You are designing a 2 dimensional game where players shoot ​bullets​ hugs at each other. Define a pseudocode function to determine whether a hug successfully 'hit' a player at a particular moment. Real parameter playerX : target player's x position Real parameter playerY : target player's y position Real parameter bulletX : x position of bullet Real parameter bulletY : y position of bullet Return Boolean : True if distance between target and player within 10 False if...
please follow this pseudocode 1) Create class (any name you want)ex: aS 2) Declaring private integer...
please follow this pseudocode 1) Create class (any name you want)ex: aS 2) Declaring private integer array empty one ex: name arr[] 3) Declare private integer variables top, size and len (my example) 4) Declare constructor for the class with the same name and inside of that public aS declare (parameter ex: int n)    5) Inside of that constructor method write command where: size is equal to n len is equal to zero array (name) is equal to new...
Scenario Suppose you are designing a piece of software for a packaging company. A part of...
Scenario Suppose you are designing a piece of software for a packaging company. A part of the software involves an items capacity limit mechanism to prevent a package from being shipped when it's filled past its capacity. Aim Define a class called Package, which will have a maximum item capacity of 6. The package should be initialized with the number of items. If the number of items exceeds the capacity limit during initialization, it should print out a message indicating...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode for a solution of the following problem. This solution will include the use of arrays needed to complete all parts of the logic. You have requested to develop a program that will record and process the rainfall totals of a 12 month period. You would use an array to store each months total. Once all 12 months amounts are entered then your solution need...
You are designing a web page that allows users to create an event listing. The event...
You are designing a web page that allows users to create an event listing. The event listing should include the date, time, location, title, phone, email, coordinator, and description of the event. The location should be between 10 and 100 characters long. The title should be between 1 and 50 characters long. The description should be between 10 and 200 characters long. Phone number consists of numbers and dashes. Email has to have an @ symbol. All data elements should...
You are designing a web page that allows users to create an event listing. The event...
You are designing a web page that allows users to create an event listing. The event listing should include the date, time, location, title, phone, email, coordinator, and description of the event. The location should be between 10 and 100 characters long. The title should be between 1 and 50 characters long. The description should be between 10 and 200 characters long. Phone number consists of numbers and dashes. Email has to have an @ symbol. All data elements should...
Pseudocode please: Assignment6B: For this assignment, you should ask the user for a day and a...
Pseudocode please: Assignment6B: For this assignment, you should ask the user for a day and a month, then determine what season it is based on that input. Write a method that takes in a month and day and returns which season it is (“Spring”, “Summer”, “Fall”, “Winter”). Your main method should be the only one that includes a print statement. Note the first days of each season: • March 19th – Spring • June 20st – Summer • September 22nd...
Reduce the following modular arithmetic WITHOUT THE USE OF A CALCULATOR: PLEASE STATE THE THEOREMS/RULES YOU...
Reduce the following modular arithmetic WITHOUT THE USE OF A CALCULATOR: PLEASE STATE THE THEOREMS/RULES YOU USE AND EXPLAIN HOW. Thanks!! a) 104^5 mod 2669 b) 11^132 mod 133 c) 2208^5 mod 2669 d) 7^1000 mod 5 e) 2^247 mod 35
Reduce the following modular arithmetic without the use of a calculator: PLEASE STATE THE THEOREMS/RULES YOU...
Reduce the following modular arithmetic without the use of a calculator: PLEASE STATE THE THEOREMS/RULES YOU USE AND EXPLAIN HOW. Thanks!! a) 104^5 mod 2669 b) 11^132 mod 133 c) 2208^5 mod 2669 d) 7^1000 mod 5 e) 2^247 mod 35
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT