logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write pseudocode while loop to sum all the values between 2 integers (A & B, input by the user), including A and B, and print the resulting sum. A must be less than B, otherwise print 0.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

ill be working on a extra credit quiz. i need help solving 5 problems. C# with pseudocode. ive attached questions that are similar

 

Q1 (25 pts): Repetition – Papers, Please?  One of the most frustrating things about technology is forgetting your password, incorrectly guessing it multiple times, and then being locked out of your account. Using either a WHILE or DO-WHILE loop (only), write a program that will repeatedly ask the user for his/her name and password, and then print “Welcome!” upon a successful login.  However, after 10 incorrect attempts, they should not receive a greeting, but instead the message “See system administrator to reset password, sucker!”  For this question, accept only one account name: “jbub” whose sickening password is “SparklingPuppies

Q2 (20 pts): Methods – Hunger Games: Assume that the average person can consume 2500 calories in one day without gaining any weight.   There are 3500 calories in one pound of fat.  Your job is to write a function/method that takes in two parameters: 1) the number of calories per day that a person eats and 2) the number of years a person will eat that many calories.  The program will return the number of pounds the person will gain (and technically work for losing weight as well).  Yes, there are 365 days in one year!  Note: a person that eats 2500 calories a day will not gain weight (for this question).  Why?

Q3 (10 pts): Methods Part 2: Correctly call the method in Q2 two times and print the results.

Q4 (25 pts): OOP – The Most Boring Class Alive.  Almost all programming textbooks insist on including a Rectangle class example that includes two class variables - width and height.  It also includes three methods inside the class – a constructor (that takes in a width and height as parameters), Area (that returns the area of the rectangle), and Perimeter (which returns the perimeter of the rectangle).  Write class Rectangle, including its class variables and methods, and try not to fall asleep.   Must… stay… awake….zzzzzzz

Q5 (15 pts): 1D – Triple Threat! Imagine we have an array (called “bob”) of 10,000 random numbers that will be fed into a program.  However, if there are three zeroes in a row (000), the program will break, the computer will smoke, and life as we know it will cease to exist.  Write code that scans array bob and detects if three zeroes appear in a row.  If three zeroes do appear in a row, print “SMOKE! RUN!”.  Otherwise, the program should not output anything.  Hint: start by finding the first zero.  What should you check for next?

Q6 (5 pts): The code below is the closest implementation of which of the following sorts:

A) BubbleSort

B) SelectionSort

C) None of the above

 

CREATE numbers[7]

numbers  { 88, 71, 47, 93, 62, 15, 49 }

CREATE temp

 

FOR i  0 to 6

   FOR j  0 to 6 - (i-1)

IF (numbers[j + 1] < numbers[j]) THEN

          temp = numbers[j]

          numbers[j] = numbers[j + 1]

          numbers[j + 1] = temp

      END IF

   END FOR

 

END FOR

 

): What is the exact output of the following pseudocode segment?


FOR I from 1 to 4

       FOR J from 1 to 4

         PRINT((J-I) + "\t")

    ENDFOR

       PRINTLINE()

 

ENDFOR

Q2 (15 points): Write pseudocode while loop to sum all the values between 2 integers (A & B, input by the user), including A and B, and print the resulting sum.  A must be less than B, otherwise print 0. 

Q3 (20 points): What is the exact output of the following pseudocode segment?

 

METHOD MAIN

CALL myMethod (0,2)
CALL myMethod (3,5)

CALL myMethod (6,7) 

END MAIN

 

METHOD myMethod(A,B)
BEGIN
    WHILE (A < B)
         PRINT(A + " ")
         A A + 1
    ENDWHILE
    PRINTLINE();

 

Q4 (20 points): Write a method, called PrintNumbers, that prints out the following sequence of numbers. The method must use a for-loop to print the outputs.

HINT: “To get started: what’s the pattern from number X to (X+1)?  Does it apply to the next pair of numbers?”

 

 

                 8 12 18 26 36 48 62

Q5 (20 points): Write a method, called CheckLetter. The method receives a letter as a parameter and returns whether the letter is a lowercase vowel (a, e, i, o, u) or not.  Sample outputs are:

 

The entered letter is: a
a is a vowel.

 

The entered letter is: b
b is not a vowel.

 

 

 

 

 


Question 1) Warmup question: Write a function named PowerXY() (only the function, no main is necessary) that takes in two numbers and returns the first number to the power of the second (e.g. passing 3 and 4 should return 81 because 3^4 = 81) (15 points)

 

Question 2) SWITCH/CASE: Zoo Atlanta has asked you to help update their feeding program. You are to determine which statement will be written to the console that tells the animal handlers which animal needs to be feed based on the following code segment: (10 points)

 

METHOD VOID animalCare(parameters: animal)

BEGIN METHOD

SWITCH(animal)

CASE ‘E’: PRINTLINE(“The ELEPHANTS need care and feeding.”)

BREAK

CASE ‘G’: PRINTLINE(“The GIRAFFES need care and feeding.”)

CASE ‘H’: PRINTLINE(“The HIPPOPOTOMI need care and feeding.”)

BREAK

CASE ‘L’: PRINTLINE(“The LIONS need care and feeding.”)

BREAK

CASE ‘Z’: PRINTLINE(“The ZEBRAS are next for care and feeding.”)

DEFAULT: PRINTLINE(“All animals must be fed”)


            END SWITCH

END METHOD

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

721 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

688 Answers

Hire Me
expert
Husnain SaeedComputer science

621 Answers

Hire Me
expert
Atharva PatilComputer science

750 Answers

Hire Me

Get Free Quote!

282 Experts Online