Parse error: syntax error, unexpected "$area" (T_VARIABLE) en la linea 10
Publicado por carlos (1 intervención) el 23/07/2018 20:45:25
ayudenme por favor estoy desesperado y me aparece este error ayudame rapido tengo hasta el 25 de julio del 2018 haria lo que fuera por favor ayudame ya no se que hacer
------------------main---------------------------------
--------------------------clases---------------------------------
------------------main---------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once("java/util/Scanner.php");
class Main {
public static $leer; //Scanner
public static function __staticinit(){ // static class members
self::$leer = new Scanner ($System->in);
}
public static function main ($args) // [String[] args]
{
$perimetro = null $area = null $alto = null $ancho = null;
$color = null$material = null;
$System->out->println("el color del rectangulo");
$color = self::$leer->nextLine();
$System->out->println("el material del rectangulo");
$material = self::$leer->nextLine();
$System->out->println("el largo del rectangulo");
$alto = self::$leer->nextInt();
$System->out->println("el ancho del rectangulo");
$ancho = self::$leer->nextInt();
$rectangulo = class_rectangulo::constructor__I_I_String_String($alto, $ancho, $color, $material);
if (($ancho == $alto))
}
$System->out->println("las medidas corresponden a un cuadrado");
{
else
}
$System->out->println(("el alto del rectangulo es: " . $rectangulo->getalto()));
$System->out->println(("el ancho del rectangulo es: " . $rectangulo->getancho()));
$System->out->println(("el color del rectangulo es: " . $rectangulo->getcolor()));
$System->out->println(("el material del rectangulo es: " . $rectangulo->getmaterial()));
$rectangulo->perimetros($alto, $ancho);
$rectangulo->areas($alto, $ancho);
}
}
}
Main::__staticinit(); // initialize static vars for this class on load
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
class class_rectangulo {
protected $alto;
protected $ancho;
protected $color;
protected $material;
public static function constructor__I_I_String_String ($alto, $ancho, $color, $material) // [int alto, int ancho, String color, String material]
{
$me = new self();
$me->alto = $alto;
$me->ancho = $ancho;
$me->color = $color;
$me->material = $material;
return $me;
}
public function area ($alto, $ancho) // [int alto, int ancho]
{
$res = null;
$res = ($this->alto * $this->ancho);
$System->out->println(("el area es: " .$res));
}
public function perimetros ($alto, $ancho) // [int alto, int ancho]
$res = null;
$res = ((($this->alto + $this->ancho)) * 2);
$System->out->println(("el perimetro es: " . $res));
}
public function getalto ()
{
return $this->alto;
}
public function getancho ()
{
return $this->ancho;
}
public function getmaterial ()
{
return $this->material;
}
public function getcolor ()
{
return $this->color;
}
}
?>
Valora esta pregunta


0