Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

ANSWER ALL PARTS IN JAVA PLEASE Part 1 Part 2 Part 3 ANSWER ALL PARTS IN JAVA PLEASE Imagine you're a software developer at a

ANSWER ALL PARTS IN JAVA PLEASE

Part 1

image text in transcribed

image text in transcribed

Part 2

image text in transcribed

Part 3

image text in transcribedANSWER ALL PARTS IN JAVA PLEASE

Imagine you're a software developer at a banking company, and you have written the following class to keep track of transactions: /** * Class to represent individual transactions class Transaction { /** * The monetary amount of this Transaction */ private double amount; /** * The description of this Transaction private String description; /** * Transaction constructor * @param amount the desired monetary amount of this Transaction * @param description The desired description of this Transaction public Transaction(double amount, String description) { this.amount = amount; this.description = description; /** * Get this Transaction's amount * @return This Transaction's amount * public double getAmount() { return this. amount; /** * Set this Transaction's amount * @param newAmount The desired new amount public void setAmount(double newAmount) { this.amount = newAmount; /** * Get this Transaction's description * @return This Transaction's description public String getDescription() { return this.description; /** * Set this Transaction's description * @param newDescription The desired new description * public void setDescription(String newDescription) { this.description = newDescription; TASK: Create a class called Transaction Manager with the following properties: It should have a private instance variable of type ArrayList Transaction> called transactions to keep track of transactions It must have a public no-parameter constructor that initializes its instance variable It must have a public method called addTransaction that has a double parameter called amount followed by a String parameter called description, and it should add a new Transaction object with amount for the amount and description for the description to the transactions instance variable It must also have an overloaded addTransaction method that only has one parameter of type double called amount, and it should add a new Transaction object with amount for the amount and "No description" for the description to the transactions instance variable It must have a public method called getTransactions that doesn't have parameters and that returns a copy of the transactions instance variable TASK: Create a class called MyArray with the following properties: It should have a private instance variable of type int[] called elements to store its elements It must have a public constructor that has an int parameter called size followed by an int parameter called defaultVal, and it should initialize elements to be an int[] of length size in which every element is defaultVal It must have a public constructor that has an int parameter called size, and it should initialize elements to be an int[] of length size in which every element is 0 It must have a public no-parameter constructor, and it should initialize elements to be an int[] of length 10 in which every element is 0 It must have a public constructor that has an int[] parameter called vals, and it should set elements to be a copy of vals It must have a public no-parameter method called getElements that returns a copy of elements TASK: Create a class called Adder with the following overloaded static add methods: One version that has two parameters of type int called x and y, and it should return their sum as an int One version that has two parameters of type long called x and y, and it should return their sum as a long One version that has two parameters of type float called x and y, and it should return their sum as a float One version that has two parameters of type double called x and y, and it should return their sum as a double One version that has two parameters of type int[] called x and y, and it should return their vector sum as a int[]. If x and y have different lengths, return null One version that has two parameters of type Object called x and y, and it should return null

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions