# 1, Branches: Leap Year A year in the modern Gregorian

1,

## Branches: 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.

Ex: If the input is:

``````1712
``````

the output is:

``````1712 is a leap year.
``````

Ex: If the input is:

``````1913
``````

the output is:

``````1913 is not a leap year.
``````

`2, `Branches: Remove gray from RGB

Summary: Given integer values for red, green, and blue, subtract the gray from each value.

Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color’s value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).

Given values for red, green, and blue, remove the gray part.

Ex: If the input is:

``````130 50 130
``````

the output is:

``````80 0 80
``````

Hint: Find the smallest value, and then subtract it from all three values, thus removing the gray

3,  Branches: Largest number

Write a program that reads three integers as inputs, and outputs the largest of the three values.

Ex: If the input is:

``````7 15 3
``````

the output is:

``15``

`3,`Variables/Assignments: Divide by x

Write a program using integers userNum and x as input, and output userNum divided by x four times.

Ex: If the input is:

``````2000 2
``````

the output is:

``````1000 500 250 125
``````

Note: In Coral, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).

4,  Variables/Assignments: Driving costs

Driving is expensive. Write a program with a car’s miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.

Output the gas cost (gasCost) with two digits after the decimal point, which can be achieved as follows:
`Put gasCost to output with 2 decimal places`

Ex: If the input is:

``````20.0 3.1599
``````

the output is:

``````1.58 7.90 63.20
``````

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. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles.

Note: Real per-mile cost would also include maintenance and depreciation.

5,  Variables/Assignments: Using math functions

Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolute value of x, and the square root of (x * y to the power of z).

Output all results with five digits after the decimal point, which can be achieved as follows:
`Put result to output with 5 decimal places`

Ex: If the input is:

``````5.0 2.5 1.5
``````

the output is:

``````55.90170 579.32402 5.00000 6.64787
``````

Hint: Coral has built-in math functions (discussed elsewhere) that may be used.

6,  Variables/Assignments: Using math functions

Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolute value of x, and the square root of (x * y to the power of z).

Output all results with five digits after the decimal point, which can be achieved as follows:
`Put result to output with 5 decimal places`

Ex: If the input is:

``````5.0 2.5 1.5
``````

the output is:

``````55.90170 579.32402 5.00000 6.64787
``````

Hint: Coral has built-in math functions (discussed elsewhere) that may be used.

7,  Arrays: Middle item

Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative number is not a part of the sorted list). Assume the number of integers is always odd.

Ex: If the input is:

``````2 3 4 8 11 -1
``````

the output is:

``````4
``````

The maximum number of inputs for any test case should not exceed 9 positive values. 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.

8,Arrays: Output values below an amount

Write a program that first reads a list of 5 integers from input. Then, read another value from the input, and output all integers less than or equal to that last 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.

Pages (275 words)
Standard price: \$0.00

### Latest Reviews

Impressed with the sample above? Wait there is more

Related Questions

### What challenges may arise if a U.S. project manager moves

[ad_1] What challenges may arise if a U.S. project manager moves to a foreign country to manage a project for 5 years? Discuss specific strategies

### Read ” Psychopathology and Use of the Diagnostic and Statistical

[ad_1]    Read ” Psychopathology and Use of the Diagnostic and Statistical Manual of Mental Disorders” by Cherry, Jacobs, Thornberry, and Gillaspy from Your Practicum

### Instructions Write a 3–4 page in which you define the

[ad_1] Instructions Write a 3–4 page in which you define the scope of your project: Provide an introduction and overview of the project. Explain why

### The case discussion is designed to make you think strategically

[ad_1]   The case discussion is designed to make you think strategically at the CIO/CISO level. In your discussion focus on how you would deal

### Instructions: Please respond to each discussion question in a narrative

[ad_1] Instructions: Please respond to each discussion question in a narrative format (APA Guidelines).  Discussion #2 Mr. F is a 38-year-old man in overall good

### Create a powerpoint with in depth speaker notes Scenario You

[ad_1]  Create a powerpoint with in depth speaker notes Scenario You are newly appointed to the communication team for a reputable philanthropic organization. The current

### Banned Book List: The Adventures of Huckleberry Finn The Confessions of Nat

[ad_1]    Banned Book List: The Adventures of Huckleberry Finn The Confessions of Nat Turner Lolita The Color Purple The Satanic Verses Catch 22 The

### APPROACHES TO TEACHING PHONICS ASSIGNMENT INSTRUCTIONS OVERVIEW Understanding the different

[ad_1] APPROACHES TO TEACHING PHONICS ASSIGNMENT INSTRUCTIONS OVERVIEW Understanding the different approaches to teach phonics is imperative to your success as a  reading teacher.  We

### 1)Explain how both the legislative and the judicial branches of

[ad_1] 1)Explain how both the legislative and the judicial branches of the U.S. government support the corporate community and the power elite. What, if anything,

### For this Assignment, you practice assessing and diagnosing patients with

[ad_1]  For this Assignment, you practice assessing and diagnosing patients with anxiety disorders, PTSD, and OCD. Review the DSM-5-TR criteria for the disorders within these classifications before

### Step 1: Experiential Exercise — What Are Your Social Values

[ad_1]    Step 1: Experiential Exercise — What Are Your Social Values Reference the section called “What Are Your Social Values” on page 136 of  