Question: Java Please, Using the template listed below import java.util.Scanner; public class TemplateForProjects { private final static String TITLE = CSC111 Project Template; private final static

 Java Please, Using the template listed below import java.util.Scanner; public class

Java Please, Using the template listed below

import java.util.Scanner;
public class TemplateForProjects {
private final static String TITLE = "CSC111 Project Template";
private final static String CONTINUE_PROMPT = "Do this again? [y/N] ";
//**********************************************
// Put as many methods you need here
//**********************************************
// Start your logic coding in the process method
private static void process(Scanner input, String args[]) throws Exception {
// Following code is merely a sample, delete it
System.out.print("Enter value: ");
int x = input.nextInt();
System.out.println("Processing " + x + " ...");
input.nextLine(); // Clear the Keyboard
}
//**********************************************
// Do not change the doThisAgain method
private static boolean doThisAgain(Scanner input, String prompt) {
System.out.print(prompt);
String doOver = input.nextLine();
return doOver.trim().equalsIgnoreCase("Y");
}
//**********************************************
// Do not change the main method
public static void main(String args[]) throws Exception {
System.out.println("Welcome to " + TITLE);
Scanner input = new Scanner(System.in);
do {
process(input, args);
} while (doThisAgain(input, CONTINUE_PROMPT));
input.close();
System.out.println("Thank you for using " + TITLE);
}
}

Design and implement a class named Triangle. The class contains: - Three double data fields named side1, side2, and side 3 with default values 1.0 to denote three sides (lengths) of the triangle. Sides are in no particular order. - The accessor (getters) methods for all three data fields. - Mutator (setters) methods for all three fields. Remember you can't except a zero or negative numbers as sides. - A no-arg constructor that creates a default triangle. - A constructor that creates a triangle with the specified side1, side2, and side3. sum of the other two. Think about it. Can you have a triangle if the sides are 1,100,2? - A method named getArea() that returns the area of this triangle. Use Heron's Formula to compute the area. If the triangle is not valid, return -1. - A method named getPerimeter() that returns the perimeter of this triangle. If the the triangle is not valid, return 1. - A method named toString() that returns a string description for the triangle. This method should return something like Triangle: side1 = 10 , side 2=5, side3 =7 error messages if the triangle is not valid. When submitting the gist, make sure the gist contains 2 files, the main driver and the Triangle class. Add the global header to all the files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!