We want to buy the car depending on its cost for 10 years. Here is the algorithm for deciding which car to buy depend a price of OMR 4.000 per liter of gas and usage of 15,000 kilometers per year. For each car, compute the total cost as follows: annual fuel consumed = annual miles driven / fuel efficiency annual fuel cost = price per gallon x annual fuel consumed operating cost = 10 x annual fuel cost total cost = purchase price + operating cost If total cost1 < total cost2 Choose car1. Else if total cost1 > total cost2 Choose car2. Else Choose car1 or car2
Q: Given two prime numbers, P1 and P2, your task is to reach from P1 to P2 by changing only one digit…
A: C++ Code: #include<iostream>#include<bits/stdc++.h> using namespace std; class prime {…
Q: Population growth at a constant annual growth rate of r% is governed by a simple equation: Pn = Pn-1…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Q: Mr. White and Pinkman earned money from their first drug contract. There is an N type of dollar such…
A: Explanation: First line will contain T, number of testcases. Then the testcases follow. Each…
Q: A very successful cinema director named "Chef" decided to solve the problem. When a customer wants…
A: Input - Output Defination: Input begins with an integer T: the number of test cases.Each test case…
Q: In a candy store, there are N different types of candies available and the prices of all the N…
A: In this question, we are asked to write a program in C++ where we have to print minimum amount of…
Q: Question: If you are in a city and have to walk from where you are, having planar coordinates (0,0),…
A: #include <stdio.h> #include<math.h> int main() { //declaring varioables float…
Q: A student wants to find out his final grade.There are three quizzes worth 10 points each, a midterm…
A: #include <stdio.h>int main(){ int q1,q2,q3,mid_term,final; float…
Q: What is the value of X after solving the following equation? X = ((5^ 2/ 5) ^2 + 5) - 10 * 4/2 + 12…
A: It will solve according to priority operator ^ mod / and * left to right + and - left to right
Q: We are buying a guidebook and a towel for a total sum of 110 dollars. The guidebook costs 100…
A: Let the cost of guidebook be g. Let the cost of towel be t.
Q: Let l be a line in the x-y plane. If l is a vertical line, its equation is x real number a. Suppose…
A: We have to write a c++ program in the following statement given in the x-y plane.
Q: In a candy store, there are N different types of candies available and the prices of all the N…
A: Code is given below as :
Q: Calculate income tax for the given income by following the below rules: Total Income Rate (in %)…
A: In the above code, it has been asked to print the income tax on the given income, in the following…
Q: the value of factor(P/F,i,10) can be found by getting the factor values for(P/F,i,4) and(P/f,i,6)and…
A: The value of factor (P/F,i,10) = 1(1+i)n = 1(1+i)10 The factor value of (P/F, i,4) = 1(1+i)4 The…
Q: You have N dollars and you have a list of k items L1, ..., Lk that you wish to purchase from an…
A: The answer to the above-given question is given below.
Q: The following algorithm aims to return the negative of the absolute value of x (for example, if x 5…
A: Absolute value: An absolute value is the positive value of the number. If the number is positive…
Q: Q2: There are three buckets size X, Y, M (1<=X<=Y<=M). All three buckets are initially empty. Using…
A: In program first we get three values from user x y z. x<=y<=z so we check what is difference…
Q: Lao Wang sold apples in n days (n < = 5). For example, n is five days. On the first day, he sold…
A: Code: #include <iostream>#include <string>using namespace std;int main (){char Apples =…
Q: You are given N sticks, where the length of each rod is a positive number. The cutting work is done…
A: APPROACH-: while stick array size is >=1 do following operation print size of array initialize…
Q: ven F: Z to Z and G:Z to Z by the rules F(n) = 2n and G(n) = [n/2] for every integer n. Is Go F =Fo…
A: 1)B Because the values are already given for Fand G. So while executing it update the value of…
Q: Suppose you have the Degree, and then * :find the Result As fallow Status 1 Temperatures -15 3 15 4…
A: #include<iostream>using namespace std;int main(){ int temp[10],min=100; cout<<"Enter the…
Q: Jhon and Tom earned money from their first drug contract. There is an N type of dollar such as A1,…
A: Input/Output Explanation: First line will contain T, number of testcases. Then the testcases…
Q: A = payment Amount per period P = initial Principal (loan amount) r= interest rate per period n=…
A: According to the information given:- you need the function to implement the instruction and make…
Q: Find the value of x from the following equation * x=cos(r^2 ) if r<O x=sin(r^2 ) if r20 r=-2:20 For…
A: Option 1 is the correct option.
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: Suppose we have a nice young couple who borrow $700000 from the bank, at an annual interest rate of…
A: monthly.payment<-2000 im<-(1+3.124/100)^(1/12) # annual interest is in percentage convert into…
Q: Example 2: Calculate the estimated height of the boy in the fourth position. position X 1 2 3 (x)…
A: Answer in step 2
Q: corporate profits sum The sales purchases experses profit 4% tax I profit all compares) 1000 5000…
A: 1) =MIN (F3:F7)
Q: Let's consider a long, quiet country road with houses scattered very sparsely along it. (Picture the…
A: Here is your solution:-
Q: A chemistry teacher asked her class to answer the following question: If I put 10 bacteria on the…
A: EXPLANATION: - The numBacterialAlive method computes the total number of bacteria alive after N…
Q: here is a promotional offer in a bookstore "Take 3, pay for the 2 more expensive ones". So, each…
A: #include <iostream> #include <math.h> #include <algorithm> //#include…
Q: A bank teller has money available in the form of 4 denominations of 1, 5, 50, and 100. Whenever a…
A: Lets see the solution.
Q: Zone, N = (sum of digits of your student id)% 8 For example, if your student id is 17301283, zone…
A: Program Approach:- Creating a function which takeStudent ID and returns its sum of digits. Using…
Q: You are given n users, and their times that they log in and out of a website: You are interested in…
A: Solution:-- 1)As given in the question it has required for the solution which is to be provided as…
Q: You are given N sticks, where the length of each rod is a positive number. The cutting work is done…
A: Input-Output Explanation The first line contains a single integer N.The next line contains N…
Q: suppose someone pays 100.00 during the first year and that yearly payment keeps on doubling. Display…
A: Summary: In this question, we have been given the yearly payment of a person and his payment doubles…
Q: X-Kingdom has trapped n number of soldiers of their opponent. They want to execute them. They…
A: The objective is to write the program based on the given data and output also.
Q: Fix the example such that the cost of frozen yogurt is O if you pour exactly 1 Ib. in your cup. * 1…
A: Here, we are checking if weight is less than 1 and also weight is greater than 1 So, you can add the…
Q: cost? 8.90 tax? (y/n) y cost? 11.21 tax? (y/n) y cost? 6.32 tax? (y/n) n For your review, here are…
A: 1) Below is C++ Program to read customers 5 item price and tax, calculate totol price ans tax and…
Q: X-Kingdom has trapped n number of soldiers of their opponent. They want to execute them. They…
A: C Program:// Include the header files#include<stdio.h>#include<stdlib.h>// Declare and…
Q: An arcade machine accepts $0.50 and $0.75 tokens. Once the machine accepts at least $1.00, it stops…
A: DFA refers to deterministic finite automata. DFA machine reads an input string one symbol at a time.
Q: An amortization calculator is used to determine the periodic payment amount due on a loan (typically…
A: A = P(i + i/((1+i)^n-1)) where, A = periodic payment amount. P = amount of principle. i = periodic…
Q: Statisticians use the concepts of mean and standard deviation to describe a collection of numbers.…
A: Program :- import math def gradeCurve(scores, m, s): """ Function that finds grade…
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: A chemistry teacher asked her class to answer the following question: If I put 10 bacteria on the…
A: ALGORITHM:- 1. Check the base condition if the hour==0. 2. Then return 10. 3. Else return…
Q: Your score of PDS Lab is determined as follows: Final Score (T) = Marks obtained (M) X…
A: Program description: M, N, and K are the user input float variables used to take the values of marks…
Q: The distance between two points in a grid is based on a strictly horizontal and/or vertical path…
A: from numpy.testing import assert_equal# defining function which consumes 4 parametersdef…
Q: Write a program that will compute for depreciation. The straight line formula for computing…
A: As there is no language mentioned so the question is attempted in python language. Program…
Step by step
Solved in 2 steps
- We are buying a guidebook and a towel for a total sum of 110 dollars. The guidebook costs 100 dollars more than the towel. How much does the towel cost (in dollars)? (Give the answer as an integer, the cost of the towel in dollars.)You have N dollars and you have a list of k items L1, ..., Lk that you wish to purchase from an online store. If you purchase an item, then the online store gives you some reward points. For an item Li , 1<= i <= k, the price and reward values are Pi and Ri, respectively. Both Pi and Ri are integers. Unfortunately, there is a threshold T on the total reward you can earn. In other words, if the sum of reward values for the items you purchase is more than T, then any reward point beyond T will be wasted. Write an efficient algorithm (to the best of your knowledge) to find a list of items within N dollars such that purchasing them will maximize the sum of reward values but will keep the sum within the threshold T (Note: the sum can be equal to T). Briefly describe why it is a correct algorithm, provide pseudocode, and analyze the time complexity. Example: Input: N = 10, k = 3, T = 100, P = [4,6,5], R = [40,70,50] Output: L1, L3. Here is an explanation. Note that you have the…Suppose, you are working in a company ‘X’ where your job is to calculate the profit based on their investment.If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profitof 4.5 dollar.For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and multiple of 100.Complete the RECURSIVE methods below that take an array of integers (investments)and an iterator (always sets to ZERO(‘0’) when the…
- Suppose, you are working in a company ‘X’ where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to…Suppose, you are working in a company ‘X’ where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% whereas for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. The investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to…To cut an 'n' centimeter-long gold bar into 2 pieces costs $n. When a gold bar is cut into many pieces, the order in which the cuts occur can affect the total amount of costs. For example, to cut a 20 centimeter gold bar at length marks 2, 8, and 10 (numbering the length marks in ascending order from the left-hand end, starting from 1). If the cuts to occur in left-to-right order, then the first cut costs $20, the second cut costs $18 (cutting the remaining 18 centimeter bar at originally length mark 8), and the third cut costs $12, totaling $50. If the cuts to occur in right-to-left order, however, then the first cut costs $20 time, the second cut costs $10, and the third cut costs $8, totaling $38. In yet another order, the first cut is at 8 (costing $20), then the 2nd cut is at 2 (costing $8), and finally the third cut is at 10 (costing $12), for a total cost of $40. Given an 'n' centimeter-long gold bar G and an array C[1..m] containing the cutting points in ascending order): a.…
- Imagine playing a number guessing game. A side is a number from 0 to Nhe's holding it, and the other side is trying to find that number by taking turns guessing. Number-holding side estimatehe has to offer one of the following three options in response to the party that did it:1-Your guess is correct, you found the number I kept (Game Over).2-Your estimate is wrong, but you are closer to the correct estimate than the previous estimate.3-the wrong estimate and the correct estimate are further away than the previous estimate.To find the estimated number in an environment where all the information is these, astrategy will be followed: Make a prediction (N/2) from the exact middle of N with 1 Begin:Find out the answer to your guess. [answer=answer_ogren (guess)]If the answer is equal to 1, the game is over, you can leave.If the answer is equal to 2, you are going in the right direction, keep the forecast direction;If you're heading for small numbers, the new N is now N/2.Make a guess…A local merchant goes to a market to buy apples with 500 UM. They offer two types of apples: green ones at 0.5 UM per kg and red ones at 0.8 UM per kg. We know that he only has space in his van to transport a maximum of 700 kg of apples and that he plans to sell a kilo of green apples for 0.58 UM and red apples for 0.9 UM. Solve the problem with the graphical method.- How many kilograms of apples of each type should you buy to obtain maximum profit?Suppose a person can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. A person can redeem 3 coupons for one chocolate bar from the machine. This means that once a person has started buying chocolate bars from the machine, he/she always has some coupons. A person would like to know how many chocolate bars can be bought, if a person starts with N dollars and always redeem coupons, if he/she has enough for an additional chocolate bar. For example: With 3 dollars a person could buy 4 chocolate bars after purchasing 3 bars giving him/her 3 coupons and then redeeming the 3 coupons for one bar. This would leave him/her with one extra coupon. Thus, will have 4 chocolate bars and still have one coupon leftover. For 11 dollars, a person can have 16 chocolate bars and still have one coupon leftover. For 12 dollars, a person can have 17 chocolate bars and have two coupons leftover. Write a complete Python program that prompts a buyer to input…
- Suppose we have a nice young couple who borrow $700000 from the bank, at an annual interest rate of3.124%. The mortgage is a 30 year loan, so they need to pay it off within 360 months total. Our happycouple decide to set their monthly mortgage payment at $2000 per month. Will they pay off the loan intime or not?Note that the monthly balance will be calculated asbalance = (im × previous balance) - monthly paymentwhere the convert annual interest to a monthly multiplier im is calculated as im = (1 +i)1/12 and i = annualinterest rate.Write a loop for track the total payment in 360 months so that we can evaluate if the couple can pay off theloan. Write in R Please and thank you.You and your friends decided to hold a “Secret Santa” gift exchange, where each person buys a gift for someone else. To see how this whole thing works, let’s consider the following example. Suppose there are 7 people A, B, C, D, E, F, and G. We denote x → y to mean “x gives a gift to y.” If the gift exchange starts with person A, then they give a gift to E. Then E gives a gift to B. And it is entirely possible that B gives a gift to A; in such a case we have completed a “cycle.” In case a cycle occurs, the gift exchange resumes with another person that hasn’t given their gift yet. If the gift exchange resumes with person D, then they give a gift to G. Then G gives a gift to F. Then F gives a gift to C. Then finally C gives a gift to D, which completes another cycle. Since all of the people have given their gifts, the giftexchange is done, otherwise the gift exchange resumes again with another person. All in all, there are two cycles that occurred during the gift exchange: A → E → B → A…suppose someone pays 100.00 during the first year and that yearly payment keeps on doubling. Display the year where yearly payment is greater than 50,000.00