Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Java
1. Write a PaypalAccount class to include both balance and accountID as the instance variables. Make sure each instance of this account will have a unique accountID. In other words, different account object should have different accountID (hint: class variable).
2. Write a Bank class with main method. In the main method, ask the user to input how many accounts (say numOfAccount) to be generated in the bank (assuming less than 1000). Then create an array to hold these numOfAccount of Account objects. For eachAccount object, generate a random balance in the range of 0.0-1000.0.
-
Assume that your campus ID is abc-de-fghi; search the array to see if there is an account with accountID asabc (the first three digits of your campus ID). If there is not an account with accountID as abc, then set the accountID of the last account in the array as abc; transfer all the balance of the first account to the account with accountID of abc.
- Set the balance of the account with accountID of abc to be efhi/100.0 (i.e your last 5 digits of your campus ID divided by 100.0); and print out the information of this account
- Find the average account balance of all the accounts in the array and print it out
- Find the account with the largest balance, print out its accountID and balance
- Find the account with the lowest balance, print out its accountID and balance.
Ther is an example provided in the attachment.
Campus Id: 141-88-2014
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 6 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Java program: 1. Write a PaypalAccount class to include both balance and accountID as the instance variables. Make sure each instance of this account will have a unique accountID. In other words, different account object should have different accountID (hint: class variable). 2. Write a Bank class with main method. In the main method, ask the user to input how many accounts (say numOfAccount) to be generated in the bank (assuming less than 1000). Then create an array to hold these numOfAccount of Account objects. For eachAccount object, generate a random balance in the range of 0.0-1000.0. Assume that your campus ID is 141-88-2014; search the array to see if there is an account with accountID as 141 (the first three digits of your campus ID). If there is not an account with accountID as 141, then set the accountID of the last account in the array as 141; transfer all the balance of the first account to the account with accountID of 141. Set the balance of the account with accountID…arrow_forwardJAVA:arrow_forwardFor beginning Java: The Person, Student, Employee, Faculty, and Staff classes 1) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and e-mail address. A student has a class status (freshman, sophomore, junior, or senior). An employee salary (double), and date hired. Use the java.time.LocalDate class to create an object for date hired. A faculty member has office hours (example: “Friday 3-4PM”) and discipline (like “Computer Science” or “Math”). A staff member has a title. Override the toString method in each class to display the class name and all related data. Draw the UML diagram using MS Word or PowerPoint for the classes and implement them. 2) Write a test program that creates a Person, Student, Employee, Faculty, and Staff, and invokes their toString() methods. Your program needs to read a text file containing data for these objects. One line for each object.…arrow_forward
- Student.java /* Given the partial code for the class Student that contains 3 attributes: name, studentNumber and course. You are to provide the setter and getter methods as well as the body of the constructor that has a missing body. You are also required to provide an implementation to the method showStudentInformation() so that once it is called it should display the name, studentNumber and course of the Student object.*/ public class Student{ private String name; private int studentNumber; private String course; // this is constructor #1 - no need to add anything here public Student() {} // this is constructor #2 - you have to provide the body of this constructor public Student(String name, int studentNumber, String course) { // complete the body of this constructor } // put your setters here // put your getters here public void showStudentInformation() { // this method should display the name,…arrow_forwardUsing Java code the following problem: Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. The Counter class should contain a single integer as instance data, representing the count. Write a constructor to initialize the count to zero. Write a method called click that increments the count and another method called getCount that returns the current count. Include a method called reset that resets the counter to zero. Finally, create a driver class called CounterTest that creates two Counter objects and tests their methods.arrow_forwardIt has just one Main class which tests abstract class Animal and its 3 subclasses: Dog, Cat, and Fish. It also tests the Talkers: Dog, Cat, and Radio. So your job is to write all 6 of these simple classes (they should be less than one page each) : Talker.java - the interface Talker, which has just one void method called speak() Animal.java - the abstract class Animal, which stores an animal's name. (No abstract methods). It should contain 2 methods: a constructor with 1 argument (the name) a method getName() which returns the name. Dog.java - the class Dog, which extends Animal and implements Talker. It should contain 3 methods: a constructor with no arguments, giving the dog a default name of "Fido" a constructor with 1 argument (the name) a speak() method that prints "Woof" on the screen. Use @Override Cat.java - the class Cat, which extends Animal and implements Talker. It should contain just 2 methods: a constructor with 1 argument (the name) (no default name like dogs…arrow_forward
- Complete all the following questions correctly as they are linked and connected altogether in Java Programming:1. Create a class named 'Student' with String variable 'name' and integer variable 'roll_no'. Assign the value of roll_no as '2' and that of name as"John" by creating an object of the class Student.2. Assign and print the roll number, phone number and address of two students having names "Sam" and "John" respectively by creating two objectsof class 'Student'.arrow_forwardIt has just one Main class which tests abstract class Animal and its 3 subclasses: Dog, Cat, and Fish. It also tests the Talkers: Dog, Cat, and Radio. So your job is to write all 6 of these simple classes (they should be less than one page each) : Talker.java - the interface Talker, which has just one void method called speak() Animal.java - the abstract class Animal, which stores an animal's name. (No abstract methods). It should contain 2 methods: a constructor with 1 argument (the name) a method getName() which returns the name. Dog.java - the class Dog, which extends Animal and implements Talker. It should contain 3 methods: a constructor with no arguments, giving the dog a default name of "Fido" a constructor with 1 argument (the name) a speak() method that prints "Woof" on the screen. Use @Override Cat.java - the class Cat, which extends Animal and implements Talker. It should contain just 2 methods: a constructor with 1 argument (the name) (no default name like dogs…arrow_forwardWrite in Javaarrow_forward
- JAVA PROGRAMMING - Create an interface "Employee" which has the attribute: rate, and the method getSalary(); - Implement the Employee interface with two classes: Hourly and Commissioned. - Hourly employees has the following additional attribute: hoursWorked. Hourly wage is 300 money. - Commissioned employee has the following additional attribute: itemSold. Commissioned employees get 200 money per item. If item sold is greater than 100, any items sold after 100 has +10 money bonus. Inputs: 1. First line contains the type of Employee (Hourly or Commissioned) 2. Second line is for the hours worked or the items sold depending on the type of Employee. Output: Enter type of Employee: Hourly Enter hours worked: 10 Salary: 3000arrow_forwardPython:Please read the following. The Game class The Game class brings together an instance of the GameBoard class, a list of Player objects who are playing the game, and an integer variable “n” indicating how many tokens must be aligned to win (as in the name “Connect N”). The game class has a constructor and two additional methods. The most complicated of these, play, is provided for you and should not be modified. However, you must implement the constructor and the add_player method. __init__(self,n,height,width) The Game constructor needs to initialize three instance variables. The first, self.n, simply holds the integer value “n” provided as a parameter. The second, self.board, should be a new instance of the GameBoard class (described below), built using the provided height and width as dimensions. The third, self.players, should be an initially empty list. add_player(self,name,symbol) The add_player method is provided a name string and a symbol string. These two values should be…arrow_forwardWrite the Circle class:• A Circle has a radius– Add instance variable– 2 constructors – one should be the default or no args– Add accessor and mutator method for each instance variable– Add methods to calculate Area, Perimeter, and Diameter– Write a printArea method in the main program which receives an object circleand “times” integer– printArea() will print the radius and area of objects “times” time by changingthe radius of object.public static void printAreas(Circle c, int times) {System.out.println("Radius \t\t Area");while (times>=1) {//print the radius and area here// create a new object by changing the radius heretimes--;}}//end of printAreasarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education