AcEBALL23 Posted October 14, 2012 Share Posted October 14, 2012 Problem Description (Using “While” Loop Only) Margaret has looked at the wind floating over the prairies for a long time. After these observations, she has created a formula that will describe the altitude of a weather balloon launched from her house. In particular, her equation predicts the altitude A (in metres above the ground) at hour t after launching her balloon is: A=-6t^4 + ht^3 + 2t^2+ t Where h is an integer value representing the humidity as a value between 0 and 100 inclusive? Margaret is curious at what the earliest hour is (if any) that her weather balloon will hit the ground after launch, so long as it is no more than the maximum time, M, that Margaret is willing to wait. You can assume that the weather balloon touches ground when A ≤ 0. Margaret has looked at the wind floating over the prairies for a long time. After these observations, she has created a formula that will describe the altitude of a weather balloon launched from her house. In particular, her equation predicts the altitude A (in metres above the ground) at hour t after launching her balloon is: Where h is an integer value representing the humidity as a value between 0 and 100 inclusive? Margaret is curious at what the earliest hour is (if any) that her weather balloon will hit the ground after launch, so long as it is no more than the maximum time, M, that Margaret is willing to wait. You can assume that the weather balloon touches ground when A ≤ 0. In order to do this, your program should use the formula to calculate the altitude when t = 1, t = 2, and so on, until the balloon touches the ground or t = M is reached. Input Specification The input is two non-negative integers: h, the humidity factor, followed by M, the maximum number of hours Margaret will wait for the weather balloon to return to ground. You can assume 0 ≤ h 100 and 0 < M < 240. Output Specification The output will be one of the following possibilities: The balloon does not touch ground in the given time. The balloon first touches ground at hour: Where T is a positive integer value representing the earliest hour when the balloon has altitude less than or equal to zero. Sample Input 1 30 10 Output for Sample Input 1 The balloon first touches ground at hour: 6 Sample Input 2 70 10 Output for Sample Input 2 The balloon does not touch ground in the given time. Please help...... Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/ Share on other sites More sharing options...
Mahngiel Posted October 14, 2012 Share Posted October 14, 2012 I don't want to do my homework either. How about you write my 15 page essay on elder victimization and i'll do this? Lemme know if we have a deal. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385066 Share on other sites More sharing options...
ManiacDan Posted October 14, 2012 Share Posted October 14, 2012 Did you just make that topic up, or are you studying to be a social worker or something? Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385068 Share on other sites More sharing options...
Mahngiel Posted October 14, 2012 Share Posted October 14, 2012 (edited) Did you just make that topic up, or are you studying to be a social worker or something? Nah, I'm almost finished with my crim law / crim justice split degree (thank god, 3 classes left), and the class is Victimology. I've sat on this essay for a month. now i gotta finish by monday =/ Edited October 14, 2012 by Mahngiel Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385069 Share on other sites More sharing options...
PFMaBiSmAd Posted October 14, 2012 Share Posted October 14, 2012 I'm kind of curious what programming language you are supposed to be doing this in, because in PHP the ^ doesn't mean what your equation thinks it is. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385070 Share on other sites More sharing options...
ManiacDan Posted October 14, 2012 Share Posted October 14, 2012 Ah, criminal justice. I knew a lot of social workers (dated a few, in fact) who did similar classes. Don't know why anyone would voluntarily get an MSW, your path is much more lucrative and powerful, while still allowing you to help people. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385072 Share on other sites More sharing options...
Mahngiel Posted October 14, 2012 Share Posted October 14, 2012 Thanks. It wasn't designed to be that way. After 8 years in the service, the only logical path I was suited for was law enforcement. By the time I finished my AA, I was convinced to interdiscipline-ize my degree in Crim Justice with Law. I have no idea what I'm going to do with it, but every federal position is available to me. I'll likely continue on and get a Juris Doctorate over the next few years. That is, if I quit looking for excuses not to write this damned essay... Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385073 Share on other sites More sharing options...
Mahngiel Posted October 14, 2012 Share Posted October 14, 2012 Also, I wonder if OPs post was written in a while loop.. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385074 Share on other sites More sharing options...
AcEBALL23 Posted October 14, 2012 Author Share Posted October 14, 2012 I am learning php and if your wondering wat this ^ sign means, it is basically an exponant sign. This question is supposed to b solved using while loop in php. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385076 Share on other sites More sharing options...
Mahngiel Posted October 14, 2012 Share Posted October 14, 2012 Well, you committed two cardinal sins, AcEBALL23. First, this is the introductions forum - where there's a finger wagged at people who request help in here. There's actually a sticky for it. Secondly, you've failed to understand how this forum works. Basically, you tell us the problem (good job there) and you show us what you've tried in way of accomplishing said problem (you forgot that part). If what you want is someone to do the work for you (much akin how I'm trying to pawn off my essay), you'll need to head over to the freelancer section where you can pay for this to be done. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385077 Share on other sites More sharing options...
ManiacDan Posted October 14, 2012 Share Posted October 14, 2012 @Mahngiel: Good luck to you. If you're near a national border, I have a few relatives in Border Patrol and they love it (especially if you're bilingual). If not that, look into the Marshall's or the DA's squad, especially with a military background. @AcEBALL23: What have you tried so far? You can't just copy and paste your homework and expect us to do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385078 Share on other sites More sharing options...
DavidAM Posted October 15, 2012 Share Posted October 15, 2012 Is Margaret really going to sit there for 10 DAYS (240 hours) waiting for the balloon to drop? At 0% humidity, it will never leave the ground. At 100% humidity, it comes back in 17 hours. So Margaret is not going to starve to death after all. 20 lines of code, without comments or range checks (I was bored --- and really worried about Margaret) Quote Link to comment https://forums.phpfreaks.com/topic/269438-while-loop/#findComment-1385236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.