Welcome! Log In Create A New Profile

Advanced

OOP_Adv_Calc

Posted by TiyaniN 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/17/2019 02:24PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
OOP_Adv_Calc
April 19, 2013 11:59AM
On portfolio page, oop_adv_calc.php, must we also use mySql? The tutorial letter says that we must use the knowledge gained from step 7.

Tutorial Letter 102

Step 7: Create a database on the server, and add three tables. The 1st table is named model, the 2nd table is named colour, and the 3rd table is named availability.

Another problem that I have is that when I use the class with the constructor, my calculator does not work and when I remove the function ___construct it works. Is it fine if I use the class without the constructor?

Example code:

Language: PHP
<?php // Defines the class Calculator class Calculator { // variables for value 1 input and value 2 input private $val1, $val2; // public function to add value1 and value2 public function add($val1,$val2){ $result = $val1 + $val2; // message to display after calculation echo("The sum of $val1 and $val2 is $result<br><br>"); echo("$val1 + $val2 = $result"); }
avatar
Mac
Re: OOP_Adv_Calc
April 22, 2013 08:43AM
The knowledge gained i.e. using a form

You can leave the constructor out
Re: OOP_Adv_Calc
May 20, 2013 04:08PM
I'm a bit confused by the following statement:

the form data is sent to the same page.

Must the data be sent back to the input boxes or just displayed somewhere on the page?
avatar Re: OOP_Adv_Calc
May 22, 2013 09:14PM
Hi Coder.

Just display the output somewhere on the same page. I.E. (4+4 = 8)
Re: OOP_Adv_Calc
May 24, 2013 02:12PM
this is how I did it:




Advanced calculator
First Number

Second Number

add subtract multiply divide


The result of your calculation is: 48

DF
Sorry, only registered users may post in this forum.

Click here to login