Consider the following programming problem: In 1627, Manhattan Island was sold to Dutch settlers for $24. If the proceeds of this sale had been deposited in a Dutch bank paying 5% interest, compounded annually, what would the principal balance be at the end of 2002? The following display is required: "Balance as of December 31, 2002 Is: XXXXX"; XXx is the amount calculated by your program. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items.
Q: Workers at a particular company have won a 7.6% pay increase. Moreover, the increase is retroactive…
A: Initialise the variables to 0 so that grabage values dont come up. Also for clrscr() to work, you…
Q: Write a program with two functions and a main(), each having at least two parameters. The functions…
A: Initializing 2 functions and exchanging information between them.
Q: In Python Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less…
A: PROGRAM: #Defining print_popcorn_time() def print_popcorn_time(bag_ounces): #If user's input is…
Q: You've been asked to write a program that calculates and displays the output voltages of two…
A: a) It is important to measure the sum of voltages for two circuits. There will then be three…
Q: Write a function number_of_pennies() that returns the total number of pennies given a number of…
A: Total number of pennies = number of dollars * 100 + pennies
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Given A test program and we have to complete the print_popcorn_time() function. """............""""…
Q: For a given number in binary, having combinations of 1s and 0s only, write a program that outputs…
A: NOTE: Since the programming language is not mentioned. Therefore answering questions in Python…
Q: random number between 0 and 100 inclusive and does not display it on the screen. using function :…
A: import random def playNumber(): tries = 0 num=random.randint(1, 100) while tries <6:…
Q: Two people play the game of Count 21 by taking turns entering a 1, 2, or 3, which is added to a…
A: Program intiates necessary variables and accepts only values 1/2/3 from the user if not, asks for…
Q: Given that A and B are real variables with values 1.5, and 2.5 respectively, and C is integer…
A: The given expression is following: NOT(A<0) AND (B/C<=0) The answer is FALSE or 0.
Q: n the function XZ̅ + Y, if X is false, Z is false, Y is true then the whole statement is False…
A: Answer : XZ' + Y , Here in this function if X is false which means 0. Z is false which also means…
Q: Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total…
A: Program code: #define the function print_total_inches()def print_total_inches(num_feet, num_inches):…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Herecour task is to write a python program for the task mentioned in the question. Let's prepare the…
Q: Assume that you are developing SUM modules in that: i. have 3 parameters in such a way that two as…
A:
Q: In this question we will design a vending machine with some fictitious coins. Assume the vending…
A: Given question has asked to design a vending machine with given input and output and also asked to…
Q: Write a program to take input for a number, if the number is palindrome, then display its half on…
A: Program approach:- // using header file. // using main function. // print the integer type number.…
Q: MACHINE PROBLEM 2 WRITE A COMPUTER PROGRAM USING ANY LANGUAGE OF YOUR CHOICE THAT WILL IMPLEMENT…
A: The code and the output for the above given question is below:
Q: Please answer the question in C++ only Given an integer N, let us consider a triangle of numbers of…
A: The procedure to solve the given problem: After taking the required inputs from the user, start with…
Q: Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height,…
A: given formulas to implement in program, define function base_area=base_length*base_width…
Q: I need the program to print the line "Meal options:" only when there is enough money.
A:
Q: Write a function max_magnitude() with three integer parameters that returns the largest magnitude…
A: PYTHON code for above : def max_magnitude(user_val1, user_val2, user_val3): res =…
Q: Given the following: Group A (Tom 40, Dave 67) Group B (Jade 30, Molly 25) Group C (Max 50, Comfort…
A: Given the following: Group A (Tom 40, Dave 67) Group B (Jade 30, Molly 25) Group C (Max 50, Comfort…
Q: Write a program such that the sequential input entered by the user is summed or counted, up until…
A: Programming Language used: C Implementation Code: #include<stdio.h> int add=0;int cnt=0;…
Q: The output should be a set of "commands" of the following form: "Move ring x from tower y to tower…
A: Explanation : Here this problem indicate the Non recursive Tower of Hanoi Problem. also the…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Since the coding language is not mentioned , I have done the code in python. Algorithm : Step 1 :…
Q: ROBLEM: Write a program that computes for the Electric Field and Electric Potential at a given point…
A: C++ code to calculate the electric field and electric potential
Q: Qty: X Machine A Total? Current Sol A Sol B Machine B Qty: 1 Machine A takes in X units of solution…
A: Answer: I have done code and also I have attached code as well as code screenshot and output
Q: 1. Write a program to find the value of given equation y = E b+u i=1 b=sum of prime number of x,…
A: The following functions are used in the C++ program to find sum of series: checkPrime function…
Q: Consider the following chart which contain a Human Blood Pressure classification based on systolic…
A: Actually, program is a executable software that runs on a computer.
Q: MATLAB has a function called round that rounds a number to the nearest integer. As an example, round…
A:
Q: 2. You have to design a vending machine for a 4 Tk product. The vending machine can only accept…
A: It is defined as a interpreted, object-oriented, high-level programming language with dynamic…
Q: Suppose that the requirement is to maintain the value of j+k constant while incrementing k by 1.…
A: Assertions-here comments are denoted as “{“ “}”. they state properties of program at a particular…
Q: Given the code: void e(int x, int y) { if(y<2) { cout << x << " "; return; } cout << x << " ";…
A: Given starting x and y values - x = 4, y = 4
Q: Here is the requirement of a problem: Implement int sqrt(int x). Compute and return the truncated…
A: Given:
Q: Mr Jone has two walls of different dimensions such that their dimensions are to be given input in…
A: feet1, inch1 = input("Enter the height of wall 1 : ").split()feet2, inch2 = input("Enter the width…
Q: CHALLENGE ACTIVITY 6.7.2: Function with branch: Popcorn. Define function print_popcorn_time() with…
A: 1)declare function using def keyword 2)use if else ladder to print the output based on user input…
Q: For this task, you are to write code that calculates the average age of family members. Instructions…
A: ALGORITHM:- 1. Take input for the number of family persons. 2. Take input ages for each of the…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: Code : # definition of the exact_change() method...def exact_change(user_total): # fetch the…
Q: Write a program to simulate tossing a “fair” coin. Allow the user to enter the number of…
A: In the question it is given that its a fair coin that means probability of heads and tails are…
Q: Given the following specification for a software program: A program for rail ticketing returns the…
A: BASIC_PRICE=40 BASIC_PRICE_Fredrick=35 SENIOR_CITIZEN_DISCOUNT=50 CHILDREN_PRICE=0…
Q: ed a written program with input of 3 integers and the output being the highest v
A: I need a written program with input of 3 integers and the output being the highest value.
Q: u are to create a Python program that will determine the total resistance of series and parallel…
A: We need to read in the current and voltage and compute and display the total resistance in series…
Q: Problem: Qty: X Machine A Total? Current Sol A Sol B Machine B Qty: 1 Machine A takes in X units of…
A: The answer as follows
Q: Define a function calc_pyramid_volume() with parameters base_length, base_width, and pyramid_height,…
A: Here the function calcpyramidvolume will call function calcbasearea.
Q: You have an aircraft which can fly on a fixed height. Because of some unknown reasons, this aircraft…
A: Here is the C++ code as required I have kept it very simple to understand
Q: Write a program to calculate the B power of Afor non-negative value of B. A" = Ax Ax A...xA Without…
A: Programs: Programs are the implementation of the algorithms using the programming languages.…
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. Theprice per board foot is given in the following table: Pine 0.89Fir 1.09Cedar 2.26 Maple 4.50Oak 3.10 The lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4 inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and four integer numbers. The integers are the number of pieces, width, height, and length. The letter will be one of P, F, C, M, O (corresponding to the five kinds of wood) or T, meaning total. When the letter is T, there are no…I have an assignment that needs to be turn in before monday, here's the question: Two people play the game of Count 21 by taking turns entering a 1, 2, or 3, which is added to a running total. The player who adds the value that makes the total reach or exceed 21 loses the game. Create a game of Count 21 in which a player competes against the computer, and program a strategy that always allows the computer to win. On any turn, if the player enters a value other than 1, 2, or 3, force the player to reenter the value. Save the game as Count21.java. Here's the code that I'm working on: import java.util.Scanner;public class Count21 {public static void main(String[] args) {// Scanner object to get user inputScanner scanner = new Scanner(System.in);// Stores the running total. //Displays a welcome for the user public void promptEnterKey(){System.out.println("Welcome to Count21! \n");System.out.println("Press \"ENTER\" to continue...");Scanner scanner = new…we will now develop a small game whose rules are as follows: • The program draws a random number between 0 and 100 inclusive and does not display it on the screen. using function : random.randint(1,100) • The player must guess the value of this number by typing his proposal on the keyboard. • The program displays as appropriate: – "Won" if the player has guessed the right number. The program ends immediately. – "Too big" if the player has entered a number larger than the right price. – "Too small" if the player has entered a number smaller than the right price - The player has only 5 tries before the program ends by displaying the message 'Lost!'. If the player wins after X tries, the program should display "Won after X tries!". . at the end of each game, the message "Do you want to start again? (y/n)" is displayed. If the user types 'y', a new part of the game starts, if he types 'n', the program ends by displaying how many tries it took the player on average (over all the games…
- I need the program to print the line "Meal options:" only when there is enough money. def get_possible_meals(budget, num_persons): tacos_cost = 4 empanandas_cost = 3 max_tacos = budget // tacos_cost max_empanadas = budget // empanandas_cost feasible = False print("\nMeal options:") for num_tacos in range (max_empanadas + 1): num_empanadas = (budget - num_tacos * tacos_cost) // empanandas_cost if num_empanadas > 0andnot (num_empanadas + num_tacos) % num_persons: feasible = True total_cost = num_tacos * tacos_cost + num_empanadas * empanandas_cost change = budget - total_cost print(f'${total_cost} buys {num_empanadas} empanadas and {num_tacos} tacos with ${change} change. {(num_empanadas + num_tacos) // num_persons} items per person.') ifnot feasible: print(f'You cannot buy a meal with these options.') def main(): budget = int(input('Enter budget for meal: $')) num_people = int(input('How many people are eating: ')) get_possible_meals(budget, num_people) if __name__ == '__main__':…This assignment is to write a program to score the rock-paper-scissors game. Each of two playersenters R, P, or S. The program than announces the winner as well as the basis for determiningthe winner: "Paper covers rock", "Rock breaks scissors", "Scissors cut paper", or "Draw, nobodywins". Use nested if statements (or if-else-if) to do the homework.In this assignment, you will write two functions, getThrow and checkWinner. Your getThrowfunction will be given an int representing a player number to prompt and will ask that player toenter one of rock, paper, or scissors, repeating until they enter a valid input and returning a charrepresenting the result. Your checkWinner function will be given two chars representing the throwsof the two players and will print the results of the contest. Both functions must accept both upperand lowercase inputs.Your main function will call both functions to form a complete program. Remember that youcan call a function multiple times. Your program will be…You should read this question as if the change giver is an artificial intelligence-based bank teller who has to give amounts of money to customers by automatically working out the amounts. You are asked to write a modular solution (algorithm and C program) that will accept an integer value in the range of 5-95 inclusive. Your solution should also ensure that input values are in multiples of 5. Based on valid input, your solution should calculate how many coins of each denomination should be returned, and display this to the user. Coin values are 50, 20, 10 and 5. The solution should aim to give as much of the higher valued coins as possible. For example, a poor solution for an input of 30 cents would give six 5 cent coins. A correct solution would give a 20 cent coin and a 10 cent coin. After each output, the user should be asked whether they wish to continue or exit/terminate the program. Your solution (algorithm and program) should be designed using a modular approach. This requires…
- When you use a mortgage to purchase a home, the lending institution effectively owns the home. You buy back part ownership in the home with each monthly payment. The part you have bought back is your equity in the home. If the mortgage amount is P dollars, the monthly interest rate is r as a decimal, and the term of the mortgage is t months, then your equity after k payments is E(k) = P((1 + r)k − 1) (1 + r)t − 1 dollars. In this exercise, assume that the mortgage amount is $200,000, the APR is 6% so r = .06/12 and the term of the loan is 30 years (360 months). (a) Find a formula for the equity. (b) Make a graph of the equity over 360 months, the term of the loan. (c) Does the graph show that you have half-ownership in the home halfway through the term of the mortgage? Halfway through the term of the mortgage corresponds to k1 = _______ payments. From the graph, we see that E(k1) is ________ half of the mortgage amount, so we _______ have half-ownership in the home…Construct C++ program to solve a given problem using appropriate programming techniques. Write a program that will calculate and print bills for the city power company. The rates vary depending on whether the use us residential, commercial, or industrial. A code of R means residential use, a code of C means commercial use, and a code of I means industrial use. Any other code should be treated as an error. The rates are computed as follows: R: $6.00 plus $0.052 per kwh used. C: $60.00 for the first 1000 kwh and $0.045 for each additional kwh. I: Rate varies depending on time of usage Peak hours: $76.00 for first 1000kwh and %0.065 for each additional kwh. Off-peak hours: $40.00 for first 1000 kwh and $0.028 for each additional kwh. Your program should prompt the user to enter an integer account number, the use code (type char), and the necessary consumption figures in whole numbers of kilowatt-hours. Your program should display the amount due from the user.Write a program in C++ with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function.void ExactChange(double userTotal, int& numDollars, int& numQuarters, int& numDimes, int& numNickels, int& numPennies) *C++
- Read and understand the following problem: 1. Write a program that accepts from the user an amount in Peso. It should compute the equivalent amount in HK dollar, US dollar and Canadian dollar. Display the amount in Peso and the equivalent amount in the different currencies. Given: 1 HK dollar = Php 6.51 1 US dollar = Php 50.68 1 Can. Dollar = 40.06 note: discuss or explain the solution of the problemWrite a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function:void ExactChange(double userTotal, int& numDollars, int& numQuarters, int& numDimes, int& numNickels, int& numPennies)Here's is my C++ program exercise 4-12: Suppose that billingAmount is a double variable, which denotes the amount you need to pay to the department store. If you pay the full amount, you get $10.00 or 1% of the billingAmount, whichever is smaller, as a credit on your next bill; If you pay at least 50% of the billingAmount, the penalty is 5% of the balance; If you pay at least 20% of the billingAmount and less than 50% of the billingAmount, the penalty is 10% of the balance; otherwise the penalty is 20% of the balance. Design an algorithm that prompts the user to enter the billing amount and the desired payment. The algorithm then calculates and outputs the credit or the remaining balance. If the amount is not paid in full, the algorithm should also output the penalty amount. Now here's what I have so far: #include <iostream>#include <iomanip> using namespace std; //declare constant variables //define the main functionint main(){//declare the variablesdouble…