// The "Final_Project" class. import java.awt.*; import hsa.Console; import java.util.Random; public class Final_Project { static Console c; // The output console public static void main (String[] args) { c = new Console (); int w ; String answer; char answer1 = 'y'; char answer2 = 'n'; while (answer2=='n') { c.clear(); //main menu c.setColor(Color.red); c.fillRect(1,1,100,125); c.fillRect(1,10,100,1000); c.println("Main Menu"); c.println("welcome please enter which piece you would like to view"); c.println("\n\nto see the number manipulator press 1"); c.println("to see the game press 2"); c.println("to see the string manipulator press 3"); c.println("to see the animation press 4"); c.println("to close the program press 5"); w=c.readInt(); c.clear(); // Triangle sides if (w==1) { while (answer1=='y') { c.clear(); double a,b,d,t,e,f,g,h,s; c.println("welcome this is to show the area of a triangle using herons theory"); c.println("hello please enter the three sides of your triangle."); a = c.readInt(); b = c.readInt(); d = c.readInt(); t = (a+b+d); s = ((a+b+d)/2); e = (s-a); f = (s-b); g = (s-d); h = (s*(e*f*g)); c.println("the perimeter of your triangle is " + t); c.println("the equation to use herons theory for s is s=(a+b+c)/2"); c.println(s+ " this is half of your perimeter"); c.println("so the area of your trianle would be "+Math.sqrt(h)); c.println("to continue press y to exit press n"); answer1=c.getChar(); } } if (w==2) { while (answer1 == 'y') { Random dice = new Random (); int num1,num2; c.println("this is a dice game every time the roll is equal to 2 it prints snake eyes every time it adds to 7 it prints lucky seven"); for ( int counter = 1; counter <=100; counter++) { num1 = 1+dice.nextInt(6); num2 = 1+dice.nextInt(6); if (num1+num2==2) { c.print(num1+num2+"snake eyes ,"); } else if(num1+num2==7) { c.print(num1+num2+"lucky seven ,"); } else { c.print(num1+num2+" ,"); } } c.println("to continue press y to cancel press n"); answer1=c.getChar(); } } // String Manipulator if (w==3) { while(answer1=='y') { int i,o ; String word; c.println("welcome this part of the program cncels out words that are four letters long "); for (i=1;i<6;i++) { c.println("\nplease enter a word"); word = c.readString(); o=word.length(); if(o == 4) { c.print("XXXX"); } else { c.print(word); } } c.println("to continue press y to cancel press n"); answer1=c.getChar(); } } if(w==5) c.close(); } // Place your program here. 'c' is the output console } // main method } // Final_Project class