• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Algorithym Problem

kRiLLiN47

Member
I'm working on an assignment where you need to come up with an algorithym from what was given to us for the assignment. This one doesn't make since to me:



<< The public utilities commission has decided that the electric company overcharged its customers for two months last year. To make up the difference to the customers, the commission therefore orders the company to decrease next month's bill by 12.5% for each customer. The city also levies a 5.75% utility tax on each bill, which is to be applied to the bill before it?s discounted. Also, the 12.5% discount does not apply to the utility tax. Assume electricity costs $1.23 per kilowatt-hour. Write a program algorithm to compute and display next month?s electric bill given the total number of kilowatt-hours consumed as input. Create the design to repeat the entire program until the user is ready to stop. >>



If someone can come up with the equation, that would be helpful. Thanks.

If you know how to program it in VB, then if possible put the coding in for what is needed. Thanks again.

kRiLLiN47
 
pretty simple math problem.

use a do while loop to make the program run until the user quits.

make a variable like x for the months bill, cost for the monthly bill, and hours for the usage.

take in hours as an input here.
x = hours * 1.23
temp = 0.125 * x // this is the 12.5% discount before the 5.75% tax
temp2 = 1.0575 * x // this is the 5.75% tax on the amount
cost = temp2 - temp // this is the taxed amount minus the discount

im too lazy to write the actual program, ill leave that up to you, but it looks pretty simple to me.

 
Thanks a lot, yeah I can figure out how to program the rest, but I was wondering if you would be able to help me with these 2:



<< Julia likes to jog in the morning. We are to write a program algorithm that will determine the number of miles she's jogged during any morning walk. To do this, as she jogs, she counts the number of strides she makes during the first minute and during the last minute of her jogging. Our program needs to accept, as input, these counts and the total time Julia spends jogging in hours and minutes (a total of four input values, all integers). The design then needs to compute and display the average strides per minute and the total distance Julia has jogged in miles. Assume Julia?s stride is 2.45 feet (and, remember, there are 5280 feet in a mile). >>





<< Your automobile needs repairs. You have obtained information from two different auto mechanics with different rate structures. One charges a flat fee of $60 plus 10.75 for each quarter hour. The other mechanic charges $45.50 for the first quarter hour and $15.35 each quarter hour after that. Write a design to calculate the two charges. Accept as input the number of hours worked (in whole hours). Expect to display the two charges and announce which is the cheapest. >>



If you could help that would be great
 
these are just simple math problems that you should be able to figure out. once you figure out the math behind it, the programming part is really simple. there's nothing tricky about these programs that i can see.
have you even tried looking at these assignments and trying them before asking? if not, then just give it a try, im sure you'll be able to figure them out.
 
I've been trying that, and math really isn't my strong subject, but I'm working on it. If you could help me with these 2 problems, then I will worship you!
 
take in strides1 and strides2 as inputs
take in hours and mins as inputs
avg = ((strides1 * 2.45) + (strides2 * 2.45)) / 2
distance = ((hours*60)+mins) * avg // instead of donig this, you can also use the mod function.
inmiles = distance / 5280 // edit
output avg and inmiles

//

take in the hours
for the first guy
guy1 = 60+((10.75*4)*hours)
for the second guy
guy2 = (45.50+(15.35*3))+(hours*(4*15.35)) // this is possible because the inputs are whole hours.
if statement of guy1 and guy2, whoever is less is cheaper.
outputs

//

im pretty sure these are right, havent tested them and dont feel like double checking since its not for me.
anyway, your welcome and i hope your teacher doesn't visit these forums...
 
hey Hector13 don't crap in the post... if you aren't going to contribute to the post and help a guy out than just pass by the post and leave your words to yourself.
 
So lets see, if he was asking for pirated software, then it would be okay to &quot;crap&quot; on the post? But asking someone to help him cheat on his homework is okay, right?

I have no problem helping people out with stuff, but when the OP makes no effort at all, then what is the point?

By posting the solutions you aren't helping him out at all.

Had he made any effort and asked for some help on a specific part that he needed help in (like displaying the output nicely or performing floating point division with ints) than I would be happy to help. But not for someone who just posts his homework verbatim and asks for someone else to do it; and no offense, but this &quot;assignment&quot; could be done by an 8 year old.
 
I've been working on quite a few of these problems tonight, and I'm kinda dozing off, and they are due tomorrow afternoon. I'm just looking for help on finishing them up. I have attempted at those problems, but my answers never looked right. I would have tried to figure them out, but I've already done about 10 of them.
 
<< Your automobile needs repairs. You have obtained information from two different auto mechanics with different rate structures. One charges a flat fee of $60 plus 10.75 for each quarter hour. The other mechanic charges $45.50 for the first quarter hour and $15.35 each quarter hour after that. Write a design to calculate the two charges. Accept as input the number of hours worked (in whole hours). Expect to display the two charges and announce which is the cheapest. >>

this problem isn't that hard, all you need to do is to get the number of hours. Assuming that the user only enter the number of hours, you can use a int variable for the number of hours:

int Hours;
float FirstMech, SecondMech;
<<get the number of hours from user>>
FirstMech=60+(10.75(Hours*4));//hours divide by four to get the number of quarter hours
SecondMech=45.50+(15.35(Hours*4-1));//minus one to subtract the first quarter hour
<<output the result, do some if statments and tell the user which mechanic would be the best chioce>>

hope it helps😎
 


<< int Hours;
float FirstMech, SecondMech;
<<get the number of hours from user>>
FirstMech=60+(10.75(Hours/4));//hours divide by four to get the number of quarter hours
SecondMech=45.50+(15.35(Hours/4-1));//minus one to subtract the first quarter hour
<<output the result, do some if statments and tell the user which mechanic would be the best chioce>>

hope it helps😎
>>



your code won't work, think about it, so if the user inputs 1 for one hour of work, then with your math, it will only cost 60+(10.75(1/4)) = 62.69. you are only charging the person for one quarter of an hour rather than the entire hour. also, the fact that the problem says whole hours means that you dont need to worry about quarters or halves, etc. and the secondmech part is wrong too.
 
<take in the hours
for the first guy
guy1 = 60+((10.75*4)*hours)
for the second guy
guy2 = (45.50+(15.35*3))+(hours*(4*15.35)) // this is possible because the inputs are whole hours.
if statement of guy1 and guy2, whoever is less is cheaper......>


guy2's equation is wrong, the (45.50+(15.35*3)) already gives the amount of money for the first hour. So, when you add it by (hour*(4*15.35), you are basically adding another hour.

If the number of hour is 1. you equation will be like this:
(45.50+(15.35*3))+(1*(4*15.35))=152.95. and it only costs 91.55.
 
Back
Top