473,792 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i really need help my instructor really doesnt help

1 New Member
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.jav a and ComputeLoanScan ner.java in WebCT as examples.
4) Use System.out.prin tln() to display the result in the console.
Nov 20 '06 #1
0 1198

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

Similar topics

17
4930
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 the period in the email address is the only part I am having problems with. I have posted part of my code below. Any help would be greatly appreciated. THANKS !
41
3979
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 the way i am trying to. Could some one please tell me what i am doing wrong, or another way of doing the same thing. i am trying to use the variable like this.
6
2799
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 thing to do. Impossible to buy this because so diff from C; and because binary files can't exist if it's true. What is the right way to check portably for end of file? Thanks!
5
2197
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: Objectives The purpose of this assignment is to have you practice the design of object-oriented classes, including one or more of the following concepts
1
1484
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 wrong.................THANK YOU....... ASSIGNMENT: Demonstrate to the instructor the successful completion of each program output. Have this sheet ready for instructor to sign. Hand to instructor
11
1906
by: abico | last post by:
Write a program that reads in a sequence of words and prints them in reverse order.Using STACK.
28
2124
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 because I have tested my query and it works fine. but whenever i try to submit from the page the imformation doesnt go thorugh. on a side note, if i hit refresh it tells me it cannot refresh without sending the information. i dont know if this...
5
1802
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. Assume that the bar code is to access a file that store the product descriptions, unit price and quantity of each product sold in the shop. Assume that there are only 10 products in
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.