Question
Whenever you mail a letter, you must decide how much postage to put on the envelope. You like to use this rule of thumb – use a stamp for every five sheets of paper or fraction thereof. For example, if you have 11 sheets of paper, then you use three stamps. Since you’re parsimonious, if an envelope requires more than three stamps, then you simply don’t mail the envelope. Show how the number of stamps per envelope would be calculated. Provide a solution in the form of pseudocode. Your pseudocode must read in appropriate data and print how many stamps to use.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 steps with 5 images
Knowledge Booster
Similar questions
- 6. You have taken a new job with a small marketing platform. Their main line of business is to send marketing messages to people on their extensive email list. The messages are not cheap; companies wanting to send messages must purchase them individually while specifying certain groups of people to receive them. Of course, nobody likes spam, so you try to make sure each person receives at most one marketing email a day. Suppose at the start of the day you are given a list of m messages, a list of n email addresses, and a table specifying which messages can be sent to which email addresses. Describe and analyze an algorithm that computes the maximum number of marketing emails you can send so each individual message is sent at most once and each email address receives at most one message. Advice: Reduce the problem to bipartite matching or maximum flow.arrow_forwardRead this:Selective Service Registration Registration with the Selective Service is mandatory in America. The law states "it is the duty of every male citizen of the United States between the ages of 18 and 25, to register." The law does not require women to register. Failure to register for selective service is a crime. If found guilty, a person could be fined up to $250,000. They might also receive a sentence of five years in prison. All men over 18 should register online at the Selective Service System website (www.sss.gov). Registration can also be done at any US Post Office. It is a duty that allows for freedom in America. Explain the purpose for registering with the Selective Service System. Is this action a duty or a responsibility?arrow_forwardSuppose you always eat a particular brand of cookies out of the standard-sized package it comes in from the store, which has 4 rows of cookies in equal amounts. You notice that when you eat 3 at a time, there's always one cookie left over. you decide when you purchase the next package, you'll eat 5 at a time but still, there's always one cookie left over. Since it really isn't helpful to always have a leftover cookie you decide to eat 7 at a time and there are no cookies leftover, but you do notice that in your last grab of 7 cookies, you're one cookie shortarrow_forward
- We have n glasses which can hold a varying amount of liquid. We will say that glass1 is size q1 quarts and glass2 is size q2 quarts, etc. We now give you a size, say x quarts. You must give me a glass of exactly x quarts. You are allowed to fill any glass to exactly its size and to pour any liquid from one glass into another. When you pour, you either have to empty the glass you are pouring from or fill the glass you are pouring into. Can you do it?More concrete example: G1 has size 10 quarts. G2 has size 4 quarts. G3 has size 1 quart. You can get a 5 quart drink by filling G1, pouring 4 quarts from it into G2 and 1 quart of it into G1. After that, G1 has exactly 5 quarts. In the same problem, we could get 8 quarts by filling G2 twice and emptying it into G1 twice. Given This: Write an algorithm to do this and determine its complexity.arrow_forwardSuppose you are a computer salesman and your income depend on the total sales and commissions earned for the computers that you sell. Commission rates vary depending on how many units you sold (see chart below). Your income equals to the total sales plus the commission where the commission equals to total sales times the commission rate. That is, commission = total sales * commission rate and income = total sales + commission. Total Sales Commission rate % Less than 200 sold 8% (totalsales < 200) Greater or equal to 200 sold 10% (totalsales >=200 & totalsales <400) Greater than to 400 sold 12% (if (totalsales >= 400) Use Multiway if, else if (use as many you need) and else correctly Review slides 3-CH-2 Slide 4 and 8 Write the code correctly as show in the chapter slides. Pay attention to the commission chart above: (3) input as examples shown 500, 250, 150 You can work with your team and submit your code and output in PDF. 1. Provide the user the commission rate list…arrow_forwardQ1. Let’s play a dice game with a pair of dice following these rules:1. At the beginning, you throw a pair of dice. If the two numbers add up to 5, 6, 7, 8, or 9, thegame immediately stops.2. If your first throw does not meet those 5 totals, you would continue until you get either 11 or12.Get 1000 simulations of this paired dice game. What is the average number of dice throw per game?You can use the sample() function to simulate the dice.arrow_forward
- Plot (as a function of angular frequency), the magnitude and the phase of the impedance resulting from a resistor (1.2 kOhm) and inductor (1.5 mH) in parallel. Use a logarithmic axis for the frequency, and for the magnitude. Use the range [10, 10**10] rad/s. The impedance of an inductance L is ???Ljω. Label axes. In python and can use cmath if neededarrow_forwardYour team was asked to program a self-driving car that reaches its destination with minimum travel time. Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are givenarrow_forwardNEED HELP WITH PYTHON CODE. ALSO, PLEASE PROVIDE DETAILS SEPARATELY ON HOW AND WHAT DID U USE TO GET UR CODE DONE.arrow_forward
- You have been asked to store the IDs and scores of competitors in three rounds of a game and find out total score of each and print the ID of winner who is having maximum score. Following is the data: ID Score 1 Score 2 Score 3 123 23 12 24 234 34 10 32 345 12 34 21 456 10 23 21 567 10 19 23arrow_forwardNegotiating a consumer loan is not always straightforward. One form of loan is the discount installment loan, which works as follows. Suppose a loan has a face value of $1,000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value of $1,000 by 0.15, yielding $150. That figure is then multiplied by the loan period of 1.5 years to yield $225 as the total interest owed. That amount is immediately deducted from the face value, leaving the consumer with only $775. Repayment is made in equal monthly installments based on the face value. So the monthly loan payment will be $1,000 divided by 18,which is $55.56. This method of calculation may not be too bad if the consumer needs $775, but the calculation is a bit more complicated if the consumer needs $1,000. Write a program that will take three inputs: the amount the consumer needs to receive, the interest rate, and the duration of the loan in months. The program should then calculate…arrow_forwardThis is everything that the question provides. There isn't anything else I can add to make the question more cleararrow_forward
arrow_back_ios
arrow_forward_ios