im learning java, but i like to learn it without someone breathing over my neck!
im still new but my teacher wont understand.
please see the attachment
Question 2: Write short Java statements to do the following (4 pt)
2.1 Consider the BankAccount class, add a new method IncreaseBalance that raises the current balance by a given percentage.
For example, a Bank Account with balance 100 $ will increase to 150 $ if the percentage is 0.5 (2pt)
2.2 Write only one statement to compute the length of a string str. (2pt)
Question 3: Write complete Java programs and provide a screen snapshot showing your program in execution to receive full credit.
3.1 Body Mass Index (BMI) is measure for body fitness that takes weight and height into account. Usually, a BMI above 25 is considered high and likely to indicate overweight. BMI is calculated from the equation:
10000 × (𝑤) h2
Where w is weight in kilograms and h is height in centimeters.
Write a program that asks the user about his/her width and height and output
the corresponding BMI. (3 pts)
3.2 In the 2- dimensional plane, a point is described by its two coordinates x and y. It supports these operations :
- A constructor allowing initialization of both coordinates - Accessors and mutators to its coordinates
- Translation of a point
a. Write a class, called MyPoint that corresponds to an abstraction of points in the dimensional plane. (2 pts)
b. Provide a tester class that creates one point, then translate and display the new coordinates. (2 pts)
I have added code tags to your posts. Always use the tags: doesn't it look better
I think your BMI code will work. But it can be improved. Find out about the use of printf and the % tags to print the result. Also find out why the round() call is unnecessary. Also find out about moving code out of the main method.
For the other two you need some testing code.That is an example of what will show whether your Point class works. It will need a toString method before you get decent output. Please improve the formatting in all your code; we have some suggestions here. That will make it look better. I like the way you have written nice short simple methods in the point class, but I can see a problem in the translate method. Why have you got that import; you are not using anything from that package?
I think you will have to think again about the bank class, I am afraid. Again you will need testing code similar to that for point.