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.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Biomedical science dissertation UK

Description Dissertation title: “Gap junctions in health and disease. Are these good therapeutic targets?” Summary of dissertation topic given by the university: “Gap junctions play an important part in cell signalling in multicellular systems. They consist of membrane channels through which molecules and ions pass directly from cell to cell.

1) Search your institution’s intranet or Web site for its

1) Search your institution’s intranet or Web site for its security policies. Do you find an enterprise security policy? What issue-specific security policies can you locate? Are all of these policies issued or coordinated by the same individual or office, or are they scattered throughout the institution? 2) Using the

Discussion Question Guidlines Nursing Assignment Help

Refer to the assigned reading, “Guidelines for Writing Learning Objectives.” How do health providers design educational programs to clearly articulate objectives to engage both patients as well as families? Requirements 125 words no plagirism and by tomorrow at 12:00 pm     Measurable Behavioral Learning Objectives  Clear and measurable behavioral learning objectives are

Prior to getting started with this assignment, review the detailed

Prior to getting started with this assignment, review the detailed instructions for all discussion boards on Syllabus Page 1, FAQs. Post your solution to “Chapter 13- Exercise Question” located near the end of chapter 13 in your textbook. Exercise Question: Research examples of workplace bullying, write two paragraphs about two examples,

What personal strengths do you have that would make you

  What personal strengths do you have that would make you an effective nurse leader? What potential gaps might you need to address to improve your ability to be an effective nurse leader? As a future DNP-prepared nurse, you will be called upon as a leader in your field, a

On page 197 in the course text, a scholar made

 On page 197 in the course text, a scholar made note that if he were innocent he would prefer being tried in a civil law court whereas if he were guilty he would prefer common law practices. Would you agree with the scholar’s observations? Why or why not? What basis

For this week’s discussion you are to post a PowerPoint

  For this week’s discussion you are to post a PowerPoint of the following:  “You have just been offered and accepted the position of Principal of New Hope Middle School. Please prepare a PowerPoint introducing yourself to the staff and tell them what your 1st 90 days will look like.”

Creating your ideal state

 Instructions Your country just overthrew its dictator, and you are the newly elected President. Unfortunately, due to the divisions in the country and the years of war, economic, military, and political structures are non-existent. A group of loyalists to the old dictator have been detonating bombs, murdering civilians, assassinating leaders,

Contemporary television programme and examine its media reception

Choose a contemporary television programme and examine its media reception. You need to choose a cross-section of reviews, from UK broadsheets such as The Guardian, The Times and The Independent and US newspapers such as The New York Times and The Los Angeles Times to magazines and guides such as

Ford Pinto

 The nature of ethical decision making requires that we understand mistakes made by individuals and organizations in the past and evaluate the ways in which personal values interact with organizational culture to increase the likelihood of unethical decisions. This activity allows you to build your evaluation skills by identifying issues

Write a two-paragraph summary of your thoughts of the videos:

Write a two-paragraph summary of your thoughts of the videos: https://www.youtube.com/watch?v=falHoOEUFz0&list=PLDPDyTQerfAaQUdfKH-wDHv2VeCI5bKqR https://www.youtube.com/watch?v=R-sVnmmw6WY&index=1&list=PLKiXyiMuXCLCIR6qt-c7NLYteGDLyxfS Write a one-paragraph summary of each video–6 sentences per paragraph. Make sure you identify what cognition is in your summary. Please make sure your paragraphs are at least six sentences long. You can write more than two paragraphs.

Digital Concept Map for Carl Shapiro At the end of

Digital Concept Map for Carl Shapiro At the end of this activity, a student will be able to: Describe pathological events associated with the patient’s disease process or condition. Create a plan of care and prioritized nursing interventions based on patient care needs. Identify anticipated diagnostic and physical assessment findings

1-2 PARAGRAPHS APA FORMAT REFERENCES Consider the role of HR

Premium Paper Help is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.