raj___ Posted July 9, 2008 Share Posted July 9, 2008 Hey everybody, new to this so forgive me if i'm posting in the wrong section. i'm new to the whole php scene and was wondering if you guys could help me!? Below is an excerpt of my code: <?php (in bold) /* This program */ $username = 'bob' // $weight_lbs = 140; print 'convert your weight'; // $weight_kgs = ($weight_lbs / 2.2 ; print 'bob your weight in kilograms is 60kgs'; > Ok so i have to answer these questions and I am totally confused a) Find and correct the 3 errors in the code b Add comments to the program using both single and multiline comments c) Modify the final print statement to use the variables to print the values bob and the calculated weight in kilograms d) Modify the program so that the final print statement is executed only if the value stored in $weight_lbs is more than 120 e) Re-write this program using a loop structure to add 2lbs onto the users initial weight given in lbs while the weight remains less than 180lbs My final print statement should read: Print "to reach your max weight of 180lbs you can increase your weight by 2lbs a day for $counter days"; Ok so i will greatly appreciate any help from anybody who is offering. Thanks in advance guys! Link to comment https://forums.phpfreaks.com/topic/113898-php-newbie-need-your-help-guys/ Share on other sites More sharing options...
trq Posted July 9, 2008 Share Posted July 9, 2008 We don't do homework. I'de suggest you read over your notes. Link to comment https://forums.phpfreaks.com/topic/113898-php-newbie-need-your-help-guys/#findComment-585262 Share on other sites More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 <?php $uname = 'Bob'; $wlbs = 140; $wkg = ($wlbs / 2.2); echo "{$uname} your weight in kilograms is: {$wkg}!"; //prints "Bob your weight in kilograms is: 63.636363636364!" ?> You get one freebie. Read up on syntax housekeeping, and general PHP syntax... Link to comment https://forums.phpfreaks.com/topic/113898-php-newbie-need-your-help-guys/#findComment-586007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.