Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7 PROGRAMMING TASK 3 Task: Develop a java application that creates an account with an opening balance, displays the balance, makes a deposit and a

image text in transcribedimage text in transcribedimage text in transcribed

7 PROGRAMMING TASK 3 Task: Develop a java application that creates an account with an opening balance, displays the balance, makes a deposit and a withdrawal, and then displays the new balance. The above problem can be solved by creating two classes. We want to use two classes in this example in order to show the students how a class can invoke or call the methods of another classe. So let's start by creating a class called BankAccount, the code for this class is given below As we can see clearly, the above class doesn't have a main method. This is so because we don't intend to run it as an application, rather we want to use its methods from another class called the Application class. The code for the Application class is given below: import java.util. ; public class Application public static void main(Strinn ounnrui Scanner myScannerobject //opening account System.out.println("Enter the opening balance"); System.out.println(""); double openingBalance = myScannerobject. nextDouble (); Prepared by: Ms. Haseena \} \begin{tabular}{|l|l|} 3 & System.out.println (""); \\ \} \end{tabular} 8 EXERCISES 1. Create a new project called LAB2_EXERCISES 2. Create a class in LAB2_EXERCISES that computes the area or the perimeter of the square. Given that the square area =LL and the perimeter =4L (where L is the length of the side of the square). 3. Create another class in LAB2_EXERCISES that can be used to convert a temperature from Celsius to Fahrenheit and vise versa. (Hint: Use the following formula: F=1.8C+32). 4. Create another class in LAB2_EXERCISES that can be used to calculate sum of two numbers, subtraction of two numbers and division of two numbers. 5. Create another class in LAB2_EXERCISES that can be used to swap two numbers. 6. A book in KFUPM Library has the following characteristics: Author, Name, ISDN, and status (available, borrowed). Provide appropriate constructors and a two method void borrowBook() and void returnBook() that change the status of book from available to borrowed and vice versa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions