193k views
2 votes
Project 15A - Math Application

package: proj15A

Classes: Main, Circle, Rectangular

Using your new knowledge of methods and classes create a program with an interface. The program must allow a user to enter values and calculate: Areas, Perimeters, Surface Area, and Volumes for circular and rectangular shapes.

The program must have three classes. A main class, circle class and a rectangular class.

Submit all code one after the other as text into Canvas in the following order.

• main.class
• circle.class
• rect.class

I have it all done just need to finish this code

package math;

import java.util.Scanner;

public class Main
{

public static void main(String[] args)// main method
{
Scanner nScan = new Scanner(System.in);
DecimalFormat mf = new DeciamlFormat("0.0");
Circle cir1 = new Circle(0,0);
Rectangle rec1 = new Rectangle (0,0,0);

//variables
boolean runProg = true;
int choice =0;


while(runProg)
{
System.out.print("Math calculator 3000 ver1");
System.out.print("choose a mode. \\"
+ "1 circle mode \\"
+ "2 Rectangle mode \\"
+ "3 End program");
choice = nScan.nextInt();

if(choice==1) //circle mode
{

}

else if(choice == 2) //Rectangle Mode
{

}

else if(choice == 3) //Program Shutdown
{

}

else
{
System.out.println("You may only choose 1-3. Try again.");
}



}

nScan.close();
}

}

User Natchiketa
by
4.4k points

1 Answer

6 votes

Answer:

A simple php code for the following is given below:

Step-by-step explanation:

interface Calculate {

public function area($lenght,$width);

public function perimeter($length,$width);

public function surfaceArea($length_side_1,$length_side_2);

public funcction volume($length, $width, $height):

}

interface Calculate2 {

public function area($raidus);

public function perimeter($radius);

public function surfaceArea($radius);

public funcction volume($radius):

}

Class Mian{

width=please Enter the value of width

height=please Enterr the value of height

length=please enter the value of length

lenght2=please enter the value of lenth of side 2

ridus= please enter the value of radius

Circle = new circle()

Rectangle = new rectangle()

}

Class Circle implements Calculate2{

public function area(){

area= pi*r

return area

}

public function perimeter(){

perimeter=2*pi*r

return perimeter

}

public function surfaceArea(){

surfacearea= pi*r*r

}

public function volume(){}

area=area()

volume=area*height

return volume

}

Class Rectangle implements Calculate{

public function area(lenght,width){

area= length * width

return area

}

public function perimeter(lenght,width){

perimenter=2(lenght+width)

return perimeter

}

public function surfaceArea(length_side_1, withd right place){}

surface_area 2*length_side_1 f* length_side_2_

public function volume(){}

public surface volume(length,width,height)

volume= length * width * height

return volume

}

User Codnodder
by
4.7k points