Bellow are 2 files for Pie, First is simple. It works but needs PieJavaPizza to have shown inputs. For slice and type. Radius is always a power of 2. And I am stuck.
Is it possible to make
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.NumberFormat;
Work with objects in harmony with input types?
*I know difference of input with entering manually IE: How many rabbits do you have?: 0. VS There are 0 rabbits. Strings and Int are good for that.
I wish to know how does one input objects like you were asked how many there were or whats the name of such and such. *Bellow are codes of my project test and a jpeg of dot operator errors. Pie compiled fine, PieJavaPizza only came with dot operator errors.
Please help me, and thanks for the paitence!
*link at bottom shows compile errors, I just need basic knowledge on how to input objects!
Base Class:
//Class name, Pie! - For objects to work, must one a single Class name. class Pie { //Instance variables int slice; int radius; String type; //Method void pizza() { System.out.println("Mmmmmm Pizza!"); } }
Object Class:
import java.io.* ; import java.io.BufferedReader; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.text.NumberFormat; //Just a main method - Here is where the object is in play. Must have Class Pie in front for object to be functional. class PiePizzaJava { public static void main(String[] args) { //Pizza Object Pie one = new Pie(); //Type of pizza - Using Input for what pizza ya want System.out.println("Please Enter In The Pizza you wish to make: "); one.type (); //Dot operator to set slices of pizza one.slice (); //Dot operator is always set to a 2 equation radius one.radius (); //pizza() method one.pizza(); } }
http://www.codingforums.com/attachment.php?attachmentid=7271&d=1238348947