//// Write a function tha
//// Write a function that calculates the amount of money a person would earn over// a period of years if his or her salary is one penny the first day, two pennies// the second day, and continues to double each day. The program should ask the// user for the number of years and call the function which will return the total// money earned in dollars and cents, not pennies. Assume there are 365 days// in a year.//function totalEarned(years) {/////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the next comment block. Do not alter //// any code in any other part of this file. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the previous comment block. Do not alter //// any code in any other part of this file. ///////////////////////////////////////////////////////////////////////////////////}var years = parseInt(prompt(‘How many years will you work for pennies a day? ‘));var totalDollarsEarned = totalEarned(years);alert(‘Over a total of ‘ + years + ‘, you will have earned $’ + totalDollarsEarned);//// Assuming the ocean’s level is currently rising at about 1.6 millimeters per// year. Write a function that is passed a number of years and then uses a loop// that calls the alert() function to display the total rise in ocean level for each.//// For example, if looking at the ocean level rise over 5 years the program would// display the following five alert with the values (don’t worry about rounding and// formatting the output to look nice)://// Year 1 – 1.6 millimeters// Year 2 – 3.2 millimeters// Year 3 – 4.8 millimeters// Year 4 – 6.4 millimeters// Year 5 – 8.0 millimeters//// When the loop ends the function will return the number of millimeters the ocean // has risen during this period. In this exampe, //function oceanRise(numberOfYears) {/////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the next comment block. Do not alter //// any code in any other part of this file. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the previous comment block. Do not alter //// any code in any other part of this file. ///////////////////////////////////////////////////////////////////////////////////}var numberOfYears = prompt(‘Over how many years would you like to display the rising in ocean levels? ‘);alert(‘In the next ‘ + numberOfYears + ‘ years, the ocean will have risen ‘ + oceanRise(numberOfYears) + ‘ millimeters’);//// The following program will prompt the user for a starting number and an// ending number. Assume that these are whole numbers (no decimal points),// assume the numbers are not negative and assume that the first number is // not larger than the second number.//// write a funcTion that returns the sum of the numbers from the starting// number to the ending number. For example, if the starting number is 13// and the ending number is 18 then the function will return the value of// 13 + 14 + 15 + 16 + 17 + 18. If the starting number is equal to the ending // number then simply return that number.////////////////////////////////////////////////////////////////////////////function sumOfNumbers(startingNumber, endingNumber) {/////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the next comment block. Do not alter //// any code in any other part of this file. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Insert your code between here and the previous comment block. Do not alter //// any code in any other part of this file. ///////////////////////////////////////////////////////////////////////////////////}var startingNumber = parseInt(prompt(‘What is the starting number? ‘));var endingNumber = parseInt(prompt(‘What is the ending number? ‘));var sumOfNumbersPassed = sumOfNumbers(startingNumber, endingNumber);alert(‘The sum of the numbers from ‘ + startingNumber + ‘ to ‘ + endingNumber + ‘ is ‘ + sumOfNumbersPassed);
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
