Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
The prompt asks: 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
function totalEarned(years) {
}
var yearsWorked = parseInt(prompt('How many years will you work for pennies a day? '));
alert('Over a total of ' + yearsWorked + ', you will have earned $' + totalEarned(yearsWorked));
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- PROBLEM #2: Create a function which solves for the surface area and volume of a sphere. Get a radius value from the user. The output should print like this for example: “The surface area of a sphere with radius 2 is 50.27 and the volume is 33.51." ΡΥTHON CODE: ΡΥTHOΝ OUTPUT:arrow_forwardDirectly downvote Answer correctly asap else Directly Downvotearrow_forwardphythonarrow_forward
- PROBLEM: Create a void function that prompts the user to input values for the following: • DC voltage source supply in volts; • two resistor values in ohms; and • the connection of the two resistors (whether parallel or series). The program will output the following: • total resistance depending on the selected connection in ohms; • total current in the circuit in amperes; • voltage across each resistor in volts; and • current through each resistor in amperes. SPECIFICATIONS: - You may only use the codes that we studied under our lectures - All lines of codes should have a comment. - Save your cpp file as Surname_FE (Example: Pangaliman_FE.cpp) TEST CASES: User inputs valid values Input: DC voltage source: 10 R1: 100 R2: 200 Connection (1= series or 2 = parallel): 1 Output: Total resistance: 300 ohms Total current: 0.0333 amperes V_R1: 3.33 volts V_R2: 6.67 volts I_R1: 0.0333 amperes IR2: 0.0333 amperes User inputs a 0 resistance for series DC voltage source: 5 R1:0 R2: 10 Connection…arrow_forward1.The following function is immediately invoked. function f() { return 1; } True Falsearrow_forwardComplete the following program. An object floats in any fluid, if the density of the object is lower than the density of the fluid. Write a program to determine whether an object will float in the oil where the density of oil is 0.92 g/cm³. The program will read mass and volume of an object then computes its density and determines whether the object will float. Program consists of two functions as follows: void input(. .): This function with two pass by reference parameters, reads mass and volume of an object from the user. string process(. ..): This function receives mass and volume, computes the desnity of the object using formula as shown below: density=mass / volume If the density of the object is higher than the density of oil, it will return the string "Float", if the density of the object and the oil is equal then it returns a string "Stay at some place" otherwise it will return "Submerge". main () program is given below and you are asked to write the function definitions in the…arrow_forward
- Function Name: compliments Parameters: answer1 - a boolean (True or False) representing whether the user is "smart" answer2 - a boolean (True or False) representing whether the user is "awesome" answer3 - a boolean (True or False) representing whether the user is "fun" Description: Write a function that outputs a string of compliments based on the adjectives selected by the inputs. Use the inputs True and False. The function should return the string “You are” concatenated with the compliments that are true. The three compliments should be: "smart" "awesome" and "fun". If none of the compliments are true, print the string “Goodbye.” instead. Test Cases: >>>compliments(True, True, True) You are smart awesome fun. >>>compliments(False, True, False) You are awesome. >>>compliments(False, False, False) Goodbye.arrow_forward3. Consider a function that will test whether a person is qualified to finance a luxury car. They are qualified if their annual income is greater than $100,000 and the sales price is less than $1,000,000. Income and sales price are parameters of the function. The function returns a message to the program stating whether the person is qualified or not. Complete this function table Purpose a. Name Parameters Result finance() b. Write the function: c. Write a Python program that inputs income and sales price from the user. Using a while loop, the program validates the income is greater than zero. The program invokes the finance() function with this print statement: "print (finance (income, salesPrice))" d. Test your while loop by seeing what happens when an invalid income is input and then a valid income. Then run your program once with too low an income to finance but okay sales price, once with an okay income and okay sales price, and once with an okay income but too high a sales price.arrow_forwardWhen a function is called, the actual value or data passed is known as a. None b. Parameter O c. Argument O d. Dataarrow_forward
- Oman Book Center hired you to lead a programming team that will develop a billing system for their establishment. The program will start by entering the book title, distribution area, the amount of book and the number of books. The reservation fee has a fixed value of 10 OMR The service fee has a fixed value of 5 OMR You are requested to do the following requirements: a. Create a void function with no parameter that will display your student ID and student Name. b. Create a void function with parameters that will display the book title and the distribution area. c. Create a fruitful function with parameters that will compute for the order amount. The order amount is computed as amount of book multiplied by the number of books. d. Create a fruitful function with parameters that will compute the shipment fee. The shipment fee is computed based on the distribution area. If the distribution area is International, shipment fee is 40% of the order amount, otherwise there…arrow_forwardJAVA CODE PLEASE Functions With Parameters and Return Values Quiz by CodeChum Admin Create a function named oppCase that receives one character input that is an alphabet. Return the opposite case of that character. In the main function, write a program that asks for a character input and assign it to a character variable. Call the oppCase function by passing in the character variable and assign the returned value to a variable. On the next line, print the value assigned to the variable. Input 1. One line containing a character Output Enter·a·character:·A aarrow_forwardWrite a function that returns the number of days in a year using the following header:def numberOfDaysInAYear(year):Write a test program that displays the number of days in the years from 2010 to 2020.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education