473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

i really need help my instructor really doesnt help

imma beginner and my iinstructur doesnt do hands on wit us we learn out of a lecture but it doesnt help some1 please help me


1. (The MyTriangle class) Write a class/program named MyTriangle. Within the class, define two methods as follows.

/** Returns true if the sum of ANY two sides is greater than the
third side. Otherwise, returns false. */
public static boolean isValid(double side1, double side2,
double side3)

/** Returns the area of the triangle */
public static double area(double side1, double side2,
double side3)

The formula for computing the triangle area based on the three sides is:



You are also required to write the main method in the MyTriangle class that reads three sides for a triangle from the user and checks whether it is a valid triangle (using the method isValid). If it is valid, the main method will compute the area (using the method area) and display it in the console. Otherwise, the main method will display a message stating that the triangle is not valid.

Note that you are REQUIRED to use console input and output for this assignment.

Hint:
1) In method area, calculate the value of s first. Then, apply the Math.sqrt method on the product of s, s-side1, s-side2 and s-side3.
2) You may use the solution for Programming Assignment 6 in WebCT as an example to check the validity of a triangle based on its three sides. Of course, you need to make it as a method now.
3) Use the Scanner class to obtain user inputs from the console. See programs TestScanner.java and ComputeLoanScanner.java in WebCT as examples.
4) Use System.out.println() to display the result in the console.
Nov 20 '06 #1
0 1179

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but...
41
by: Psykarrd | last post by:
I am trying to declare a string variable as an array of char's. the code looks like this. char name; then when i try to use the variable it dosn't work, however i am not sure you can use it...
6
by: Pete Wilson | last post by:
C++ instructor says, emphatically: end of file is always a NUL char in the file; count on it. When program sees a NUL, that's it, that's the end of file. And testing for NUL is always the right...
5
by: John Flynn | last post by:
hi all i'm going to be quick i have an assignment due which i have no idea how to do. i work full time so i dont have the time to learn it and its due date has crept up on me .. As follows:...
1
by: bigcjr44 | last post by:
I have an assignment do tonite and I can not get it started. We are learning about recursion. This is my assignment, and this is what I have written, could someone please tell me what I am doing...
11
by: abico | last post by:
Write a program that reads in a sequence of words and prints them in reverse order.Using STACK.
28
by: Gaby | last post by:
Hi guys, I have this ASP code that is a little long to post so but you can download it off of http://whatthedeuce.net/Form.asp I cant find out what my error is. I know it is not in my Access...
5
by: alck1234 | last post by:
Hi, I need help on my mini project on object orientated programming. The question goes like this: A mini-mart has just installed a bar code reader to improve efficiency at their checkouts....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.