Starting from:

$30

Homework 8 Solved

You are given code as part of the assignment. You need to add three lines to this code in the try-catch block in PizzaFactory. You will use reflection to create objects for various kinds of Pizza. The long comment in the try-catch has some additional information. See

https://engineering.purdue.edu/~smidkiff/ECE39595Java/Code/L24Reflection.zip for an example of

using reflection that will be helpful in finishing this homework.

Hint: because not all classes are explicitly reference in Test.java, or code explicitly called from Test.java, javac Test.java will not compile all of the classes. In particular, it will not compile the classes whose objects are created by reflection. Therefore, you should do javac *.java to build your program from the command line.

Your expected output is:

pizza 1: NY Style Cheese Pizza, Ingredients are whatever you want
pizza 2: NY Style Pepperoni Pizza, Ingredients are whatever you want
pizza 3: NY Style Clam Pizza, Ingredients are whatever you want
pizza 4: Chicago Style Cheese Pizza, Ingredients are whatever you want
pizza 5: Chicago Style Pepperoni Pizza, Ingredients are whatever you want
pizza 6: Chicago Style Clam Pizza, Ingredients are whatever you want

What to turn in:

Turn in a directory called userid, where userid is your Purdue login id. javac *.java from within userid should build your code, and java Test.java should run it.

More products