kerem wXr Posted October 13, 2010 Share Posted October 13, 2010 Arkadaşlar lise 4 öğrencisiyim. Hocamız bi ödev verdi php'de işin içinden çıkamadım. Yardım ederseniz sevinirim şimdiden teşekküerler. Soru şu; Tanımlı olan $boy ve $cinsiyet değişkenlerine göre kişinin ideal kilosunu aşağıdaki açıklamaya göre hesaplayıp ekrana İdeal Kilonuz=... şeklinde yazdırınız. Kadınlar için: Boyunuzun ilk 150 santimetresi için 45 kilo, sonraki her 2.5 cm için 2.2 kilo ekler. Örnek olarak; boyunuz 160 cm ise, ideal kilonuz 45+8.8=53.8 kilogram olacaktır. Erkekler için: Boyunuzun ilk 150 santimetresi için 48 kilo, sonraki her 2.5 cm için 2.7 kilo ekler. Örnek olarak boyunuz 180 cm ise, ideal kilonuz 48+32.4=80.4 kilogram olacaktır. Not: Bu fonksiyon boyu 150 cm ve üzerinde olan kişiler içindir.Dolayısıyla gönderilen boyun en az 150 cm olduğu varsayılır. Link to comment Share on other sites More sharing options...
sergen_1993_12 Posted October 13, 2010 Share Posted October 13, 2010 java ile yapablrm sanırsam bunu bi. ugrasıyım biraz bu aralar javayı yenı yenı ogrenıyorm da egitim videolarının bıtmesı lazm.. yınede ılgılenıcem Link to comment Share on other sites More sharing options...
kerem wXr Posted October 13, 2010 Author Share Posted October 13, 2010 java ile yapablrm sanırsam bunu bi. ugrasıyım biraz bu aralar javayı yenı yenı ogrenıyorm da egitim videolarının bıtmesı lazm.. yınede ılgılenıcem ilgine teşekür ediyorum ama php istiyor hoca :S Link to comment Share on other sites More sharing options...
galetis Posted October 13, 2010 Share Posted October 13, 2010 Asp dede olmaz o zaman Link to comment Share on other sites More sharing options...
kerem wXr Posted October 13, 2010 Author Share Posted October 13, 2010 Asp dede olmaz o zaman evet olmuyor. :S Link to comment Share on other sites More sharing options...
galetis Posted October 13, 2010 Share Posted October 13, 2010 İşte fonksiyonumuz geldi <?php $boy = 180; $cinsiyet = "bay"; if($cinsiyet == "bayan"){ $fark = $boy - 150; $bolum = $fark / 2.5; $toplam = $bolum * 2.2; $idealkilo = 45 + $toplam; echo "Bayan için ideal kilo : "; echo $idealkilo; } if($cinsiyet == "bay"){ $fark = $boy - 150; $bolum = $fark / 2.5; $toplam = $bolum * 2.7; $idealkilo = 48 + $toplam; echo "Bay için ideal kilo : "; echo $idealkilo; } ?> Link to comment Share on other sites More sharing options...
kerem wXr Posted October 14, 2010 Author Share Posted October 14, 2010 İşte fonksiyonumuz geldi <?php $boy = 180; $cinsiyet = "bay"; if($cinsiyet == "bayan"){ $fark = $boy - 150; $bolum = $fark / 2.5; $toplam = $bolum * 2.2; $idealkilo = 45 + $toplam; echo "Bayan için ideal kilo : "; echo $idealkilo; } if($cinsiyet == "bay"){ $fark = $boy - 150; $bolum = $fark / 2.5; $toplam = $bolum * 2.7; $idealkilo = 48 + $toplam; echo "Bay için ideal kilo : "; echo $idealkilo; } ?> Sağolasın kardeşim beni büyük bie dertten kurtardın Link to comment Share on other sites More sharing options...
sergen_1993_12 Posted October 14, 2010 Share Posted October 14, 2010 helalsin valla dur bende kopyalaym lazm olcak elbet Link to comment Share on other sites More sharing options...
galetis Posted October 14, 2010 Share Posted October 14, 2010 Sayenizde tam olarak Php'ye başladım Link to comment Share on other sites More sharing options...
carysma1 Posted October 22, 2010 Share Posted October 22, 2010 Ben html formu ile daha kullanışlı birşey yaptım <?php if(isset($_POST['submit'])) { if($_POST['boy'] < 150){ $boy = 150; }else{ $boy = $_POST['boy']; } if($_POST['cinsiyet'] == 'bay') $ideal_kilo = ($_POST['boy'] - 150) / 2.5 * 2.7 + 48; if($_POST['cinsiyet'] == 'bayan') $ideal_kilo = ($_POST['boy'] - 150) / 2.5 * 2.2 + 45; } ?> <html> <head> <title>İdeal Kilonuzu Hesaplayın</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> p { border: 1px solid #CCC; padding: 4px } </style> </head> <h3>İdeal Kilonuzu Hesaplayın</h3> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> Boyunuz: <input type="text" name="boy" value="<?php echo isset($_POST['boy']) ? $_POST['boy'] : ''; ?>" /> Cinsiyet: <select name="cinsiyet"> <option value="bay" selected>Bay</option> <option value="bayan">Bayan</option> </select> <input type="submit" name="submit" value="Hesapla" /> </form> <?php if(isset($_POST['submit'])): ?> <p>İdeal Kilonuz: <strong><?php echo $ideal_kilo; ?></strong></p> <?php endif; ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.