PRG211 Algorithms And Logic For Computer Programming

Need Help in PRG/211 Coral Programming Assignments?
We provide help for students all over the world.

Items 1 to 10 of 29 total

per page
Page:
1. PRG/211 Week 5 Lab 11.6 User-Defined Functions: Output values below an amount

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.6 User-Defined Functions: Output values below an amount

Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value.

Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one.

Such functionality is common on sites like Amazon, where a user can filter results.

Your program should define and use a function:
Function outputIntsLessThanOrEqualToThreshold(integer array(?) userVals, integer upperThreshold) returns nothing

2. PRG/211 Week 5 Lab 11.5 User-Defined Functions: Max and min numbers

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.5 User-Defined Functions: Max and min numbers

Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is:
largest: 15
smallest: 3

Your program should define and call two functions:
Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum
Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum
The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.

3. PRG/211 Week 5 Lab 11.4 User-Defined Functions: Leap year

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.4 User-Defined Functions: Leap year

A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:

1) The year must be divisible by 4

2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400

Some example leap years are 1600, 1712, and 2016.

Write a program that takes in a year and determines whether that year is a leap year. If the input is 1712, the output is: 1712 is a leap year. If the input is 1913, the output is: 1913 is not a leap year.

Your program must define and call a function:

Function OutputLeapYear(integer inputYear) returns nothing
The function should output whether the input year is a leap year or not.

4. PRG/211 Week 5 Lab 11.3 User-Defined Functions: Step counter

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.3 User-Defined Functions: Step counter

A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. If the input is 5345, the output is 2.6725.

Your program should define and call a function:
Function StepsToMiles(integer userSteps) returns float numMiles

5. PRG/211 Week 5 Lab 11.2 User-Defined Functions: Driving cost

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.2 User-Defined Functions: Driving cost

Write a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float.

Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975.

Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.

Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198

Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost: drivenMiles, milesPerGallon, dollarsPerGallon.

6. PRG/211 Week 5 Lab 11.1 User-Defined Functions: Miles to track laps

Regular Price: \$8.00

Special Price: \$5.00

PRG/211 Week 5 Lab 11.1 User-Defined Functions: Miles to track laps

One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.

Ex: If the input is 1.5, the output is:
6.0

Ex: If the input is 2.2, the output is:
8.8

Your program should define and call a function:
Function MilesToLaps(float userMiles) returns float userLaps

7. PRG/211 Week 4 Lab 9.3 Arrays: Output values below an amount

Regular Price: \$8.00

Special Price: \$3.00

PRG/211 Week 4 Lab 9.3 Arrays: Output values below an amount

Write a program that first gets a list of 5 integers from input. Then, get another value from the input, and output all integers less than or equal to that value.

Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one. Then, output a newline.

Such functionality is common on sites like Amazon, where a user can filter results.

8. PRG/211 Week 4 Lab 9.2 Arrays: Middle item

Regular Price: \$8.00

Special Price: \$3.00

PRG/211 Week 4 Lab 9.2 Arrays: Middle item

Given a sorted list of integers, output the middle integer. Assume the number of integers is always odd.

Ex: If the input is 2 3 4 8 11 -1 (a negative indicates end), the output is:
4
The maximum number of inputs for any test case should not exceed 9. If exceeded, output "Too many inputs".

Hint: Use an array of size 9. First read the data into an array. Then, based on the number of items, find the middle item.

9. PRG/211 Week 4 Lab 9.1 Arrays: Output numbers in reverse

Regular Price: \$8.00

Special Price: \$3.00

PRG/211 Week 4 Lab 9.1 Arrays: Output numbers in reverse

Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline.

Ex: If the input is 2 4 6 8 10 12 14 16 18 20, the output is:
20 18 16 14 12 10 8 6 4 2
To achieve the above, first read the integers into an array. Then output the array in reverse.

10. PRG/211 Week 3 Lab 7.4 Loops: Countdown until matching digits

Regular Price: \$8.00

Special Price: \$3.00

PRG/211 Week 3 Lab 7.4 Loops: Countdown until matching digits

Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.

Ex: If the input is 93, the output is:
93 92 91 90 89 88

Ex: If the input is 77, the output is:
77

Ex: If the input is not between 20 and 98 (inclusive), the output is:
Input must be 20-98

For coding simplicity, follow each output number by a space, even the last one. Use a while loop.  Compare the digits; do not write a large if-else for all possible same-digit numbers (11, 22, 33, ..., 88), as that approach would be cumbersome for large ranges.