Categories
Java

Tasks: Research, design and build a complete Java Graphical Interface for a simp

Tasks: Research, design and build a complete Java Graphical Interface for a simple Java Application of your choice
for collecting and processing its data.
Your GUI must include the following components:
JLabel
JTextField
JCombobox
JRadioButton
JCheckBox
JTextArea
ImageIcon
JButton
JPanel
JFrame
The total number of all components (a-g) combined must be 30 components or more.
Restrictions
JPanel, JFrame, and ButtonGroup are NOT qualified as one of the 30 components.
At least 20 components must allow user inputs (b-f). For example, JLabel does NOT allow users
to input anything; therefore, it cannot collect data and is NOT qualified as one of the 20
components.
Your GUI must be user-friendly.
Implement Action Listener to collect information and display it using JOptionPane for confirmation of the
process.

Categories
Java

Chapter 10 Assignment (20 points): Person and Customer Class Your goal is to des

Chapter 10 Assignment (20 points): Person and Customer Class
Your goal is to design a class named Person and a class named Customer which extends the Person class. Person Class
Create a Person class that contains the following:
Class Fields: name, address, and phone number. (2 points)
No argument constructor that initializes the object with empty strings for name, address, and phone. (2 points)
3 argument constructor that initializes the object with a name, address, and a phone number. (2 points)
Getter/setter methods for each of the fields. (3 points)
toString method that returns a string for the name, address, and phone number (2 points) (see example below):
Name: Bob Smith
Address: 123 Main Street, Plano, TX 75074
Phone: 972-333-4444
Customer Class
Create a subclass of Person named Customer that contains the following:
A field for a customer number. (1 point)
A no argument constructor that initializes the object with an empty string for the name, address, phone, and customer number. (2 points)
A 4 argument constructor that initializes the object with a name, address, a phone number, and a customer number. (2 points)
Getter/setter method for the customer number field. (1 point)
toString method that prints the information from the Person toString as well as the customer number using the keyword super (2 points). (see example below):
Name: Bob Smith
Address: 123 Main Street, Plano, TX 75074
Phone: 972-333-4444
Customer Number: 1234-5678
In the main method create an array of 4 People. Make the first 2 elements People objects and the next two elements Customer objects. You do NOT need to use Scanner or JOptionPane to get input from the user for these objects, you can enter the data directly into the array. Print each object of the array by using a loop. (6 points)
UML Diagram
Design the Person and Customer UML diagram. You can draw this diagram in Word or you can do it by hand and take a picture. Please put this UML diagram into your project folder when submitting your work. (5 points)
Test your program several times using different input to ensure that it is working properly.

Categories
Java

What is Generics? Why Generics? Show example of the Generic type and Generic Ins

What is Generics?
Why Generics?
Show example of the Generic type and Generic Instantiation.
A raw type is unsafe. Show an example of avoiding unsafe raw types.

Categories
Java

Data cleansing is an important part of data integrity. Part of data cleansing is

Data cleansing is an important part of data integrity. Part of data cleansing is properly formatting data. Phone numbers are notoriously inconsistent when it comes to data formatting, so you will do cleaning phone numbers.
Using java programming language, write a function that takes a phone number in the form of a string and returns the phone number as a cleansed string. You may assume that all phone numbers will be from the US and will contain an area code. The proper output is a 10-digit number (e.g. 2345678901).
Below are examples of possible input formats:
+1 (234) 567-8901
234.567.8901
(234) 567-8901
(234)567-8901
(234)567-8901
234 567-8901
1 (234) 567-8901
12345678901

Categories
Java

1) Find a real-world information problem that you argue demonstrates one of the

1) Find a real-world information problem that you argue demonstrates one of the common growth functions in the Algorithms materials. Explain how the problem demonstrates the function.
Think about how the number of required steps of work grows as the number of data elements to work on grows.
For example, a problem with linear complexity growth means that the work steps grow just as much as the number of data elements does, while a problem with a constant time complexity problem would not grow at all as the data elements grow. If my program must add up the sum of a set of ‘n’ integers, it will require processing every one of the ‘n’ integers, in the worst case (and average case and best case,here). Also, in terms of ‘n’, if ‘n’ grows by 1, my program’s work load also grows by 1, meaning that the work load of my program in terms of n grows just like a linear mathematical function does.
2) Is there a way to solve your problem recursively? If you argue there is, briefly explain an approach. If not, explain what prevents the use of recursion.
In fact, representing the problem well is key to realizing that it can be solved recursively. As I commented in a recent lecture, I can represent my task of scoring a set of assignments (very time-consuming) as :
1) Select the first assignment ‘a’ in set ‘S’. Score ‘a’
2) Score the rest of the set S
Notice that we can repeatedly replace “Score the rest of the set S” with

1) Select the first assignment ‘a’ in set ‘S’. Score ‘a’
2) Score the rest of the set S

until there are no assignments left in S.

Categories
Java

Animal, with the String attributes name and breed. 2. Cat and Dog are subclasses

Animal, with the String attributes name and breed.
2. Cat and Dog are subclasses of Animal.
3. AnimalI, an interface declaring two methods makeSound and whatAmI.
4. Each of the three classes will implement the interface, have a constructor and a getter. I suggest using the Generate option from the Code dropdown menu to generate these “boilerplate” methods. Also, the Animal class needs a toString method.
5. Finally, a Main class that will create a Scanner object to read a text file, containing three fields, separated by commas, type, name, and breed. Depending upon the type (A, C or D), create an Animal or Cat or Dog object and store it in an ArrayList of animals.
6. After all records have been read, iterate through the ArrayList to print the animal using the toString method.
7. Don’t forget to close the text file.