Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Please help neede Mark Sheet Code Error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Please help neede Mark Sheet Code Error

Postby machachar » Thu May 23, 2013 2:14 pm

Dear Friends,

I am beginner of php i cannot remove two errors in below given script (total marks and average).
Please help me

<?php
Class Marksheet {

public $name;
public $rollno;
public $java;
public $Csharp;
public $C;
public $Php;
public $Dotnet;
public $tot;
public $avg;
}
$Mks=new Marksheet();

$Mks->name="Mumtaz Ali";
$Mks->rollno="2323";
$Mks->java="99";
$Mks->Csharp="66";
$Mks->C="77";
$Mks->Php="66";
$Mks->Dotnet="88";
$Mks->totm="500";
$Mks->obtm=$java+$Csharp+$c+$Php+$Dotnet;// Total marks
$Mks->avg=$obtm*100/$obtm;

echo("<br>Name : " .$Mks->name);
echo("<br>Roll No: ".$Mks->rollno);
echo("<br>Java : ".$Mks->java);
echo("<br>C : ".$Mks->C);
echo("<br>Php : ".$Mks->Php);
echo("<br>Obtaind Marks : ".$Mks->obtm);
echo("<br>Total Marks: ".$Mks->totm);
echo("<br>Average of Marks: ".$Mks->avg);

?>

wish best regards,

Mumtaz Ali
machachar
New php-forum User
New php-forum User
 
Posts: 5
Joined: Tue Dec 06, 2011 2:58 pm

Re: Please help neede Mark Sheet Code Error

Postby johnj » Sat May 25, 2013 1:03 am

your marksheet class does not have those 2 properties called total marks and average. Please add these 2 to the class.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Please help neede Mark Sheet Code Error

Postby machachar » Sat May 25, 2013 2:17 am

Dear

I also put two properties program is not showing total marks and average.


modified code is given below


<?php
Class Marksheet {

public $name;
public $rollno;
public $java;
public $Csharp;
public $C;
public $Php;
public $Dotnet;
public $tot;
public $obtm;
public $avg;
}
$Mks=new Marksheet();

$Mks->name="Mumtaz Ali";
$Mks->rollno="2323";
$Mks->java="99";
$Mks->Csharp="66";
$Mks->C="77";
$Mks->Php="66";
$Mks->Dotnet="88";
$Mks->tot="500";
$Mks->obtm=$java+$Csharp+$c+$Php+$Dotnet;
$Mks->avg=$obtm*100/$tot;

echo("<br>Name : " .$Mks->name);
echo("<br>Roll No: ".$Mks->rollno);
echo("<br>Java : ".$Mks->java);
echo("<br>C : ".$Mks->C);
echo("<br>Php : ".$Mks->Php);
echo("<br>Php : ".$Mks->Csharp);
echo("<br>Php : ".$Mks->Dotnet);
echo("<br>Obtaind Marks : ".$Mks->obtm);
echo("<br>Total Marks: ".$Mks->tot);
echo("<br>Average of Marks: ".$Mks->avg);

?>
machachar
New php-forum User
New php-forum User
 
Posts: 5
Joined: Tue Dec 06, 2011 2:58 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron