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

930 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

888 Answers

Hire Me
expert
Husnain SaeedComputer science

662 Answers

Hire Me
expert
Atharva PatilComputer science

755 Answers

Hire Me
June
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30