Data structure & Algrothium java program Create the three following classes: 1. class containing two strings attributes first name and last name. 2. class containing the name object and an ArrayList of string to store the list gifts. This class would extend the attached NicePersonInterface.java 3. class containing one ArrayList of Names to store the naughty names. Another ArrayList of NicePerson to store the nice names and gifts. Add atleast 4 names in each list and display all information.
Q: Write a program which: • creates a new Array List • adds 5 decimal numbers to it • prints the list…
A: Index of a list starts from 0 Thus, for odd index, we can say remainder has to be 1
Q: Create a class Bookwhich describes its book_titleand book_price. Follow the below steps,a.Use getter…
A: Algorithm: Start Create a class named Book with book_titleand book_price as its attributes…
Q: Language: JAVA Script Your company is giving every employee earning less than $50,000 a 10%…
A:
Q: Consider the Person class below: public class Person { private String name; private int age; public…
A: Programming instructions: Create a class Person with two members name and age of String and integer…
Q: 1. Consider following class diagram: Doctor Patient -Name: String - Field:String -patientList[]:…
A: As per the requirement program is completed. Note: In the question programming language is not…
Q: n an ArrayList containing the largest and smallest integer in an array. If the array is empty,…
A: Return an ArrayList containing the largest and smallest integer inan array. If the array is empty,…
Q: 1. Deck.java The Deck class represents a deck of cards. It starts off with 52 cards, but as cards…
A: Program Files filename: Driver.java package poker; public class Driver { public static void…
Q: Java : Overview You must write a class with which we can generate user identities for employees in…
A: public class MainTest { public static void main(String[] args) { String[] names = { "Bo Ek", "Erik…
Q: *CODE SHOULD BE IN JAVA* A personal phone directory contains room for first names and phone numbers…
A: The code is completed in java. Here the maximum directory limit is 30, already 10 peoples are there…
Q: 9. Given that an ArrayList of Integers named numberList has already been created and several values…
A: ArrayList is a collection of similar elements add is the method used to append an element at the…
Q: Implement a Shoe class, encapsulating the concept of a shoe A shoe has a color, size, and brand.…
A: public class Shoe { //declaring instance variables private String color; private int size; private…
Q: 1. Declare a (local) variable of type Person, create a new Object and assign the variable to…
A: Java code to create ArrayList of type Person
Q: Please paste the code for each completed class. Do not use ArrayList. Create Playlist.java,…
A: Solution: Note: Please make sure all the file in same folder while execution. make sure it should…
Q: URGENtt!! You are asked to write a java class named "Kume". The UML class diagram of the Kume class…
A: import java.util.*; //Kume class implementation class Kume implements Comparable<Kume>{…
Q: Make a shopping cart program that implements the ArrayList class. Make a class named Item.java that…
A: Actually, Java is a high level programming language. And also object oriented .It Is a platform…
Q: Create a class ArrayList with the following functionalities as follow: ArrayList(); void PushBack(T…
A: 1. create a class array list and create a default constructor.2.Current size and maximum size set…
Q: Write a class called TwoDArray that has the following behaviors for an array of ints.…
A: Answer the above question are as follows:
Q: Create a Keylndex class with the following properties : Fields: int [] k; Description An array of…
A: The program is written in Python. Please check the source code and output in the following steps.…
Q: Part-2: Write a program that includes in its MainClass the following methods: 1. A method called…
A:
Q: Java programing Ships Study the UML diagram carefully. The green spots signify public. The red…
A: Code implemented in java Filename: Ship.java public class Ship implements Comparable<Ship> {…
Q: Deeper Class Design - the Square, Circle, Picture Class he Bigger Picture – The ObjectList (or…
A: *********ObjectList.java********/ import java.util.Arrays; public class ObjectList { /* The items.…
Q: 1. Name.java object class containing two strings attributes first name and last name (and…
A: Coupling is a measure of the dependence among modules. This dependence, for instance, ought…
Q: • A dynamic array of integer numbers. Integer variable to store array size. • Integer variable to…
A: I have written the code below:
Q: Java code 8. Given an existing ArrayList named friendList, find the first index of a friend named…
A: Here I have created a list and then stored some names into it. Next, I have iterated over the list…
Q: Create a Keylndex class with the following properties : Fields: int [] k; Description An array of…
A: The program is written in Python. Please check the source code and output in the following steps.
Q: unctions specified in the SimpleArrayList interface. Make sure the class that implements…
A: Java programming Create a file named StudentArrayList.java, within the file create a class named…
Q: Define class Shape, 2DShape and 3DShape as per UML class diagram given. Define all mutator…
A: public class Shape{ //declaring instance variables private double length; private double…
Q: Shape Class JAVA Implement the Shape hierarchy shown in figure below. Shape TwoDimensionalShape…
A: Code: ShapeTest.java: public class ShapeTest { public static void main(String[] args) { Shape[]…
Q: Q1: Write the Java code corresponding to the following UML diagram. The class School implements the…
A: Solution: Given,
Q: Create a class called Airport that models an airport. An airport's state consists of its name…
A: We need to create an Airport class in Java that has 3 data members as- name, code, and list of…
Q: Create a Vector2D class with properties x and y and a proper constructor method. Plus, minus and…
A: In this question, the coding language is not specified then we are doing this question in the CPP…
Q: Create a class called Student that models a student at Carleton University. A student's state…
A: package com.company;import java.util.Scanner;public class Main { public static void main(String[]…
Q: A] Create an abstract class named FigureAbstarctClass. i) This class has attributes: figure type,…
A: abstract class FigureAbstarctClass { int height, width; double area; String type; abstract void…
Q: Write a java program to create class Books with the data members book name, author,price and type…
A: Given: Creating a Book Class for displaying details about various Books.
Q: JAVA programming language i need to create an "addFront" method in the bottom of the code that…
A: public void addFront(int e) {//add only if there is spaceif (size >=…
Q: For the given classes, Machine, Camera and Oven. Camera and Oven are subclasses of Machine. A)…
A: Task -> In given code we need to modify some parts and add the necessary code in black spaces.
Q: va code 12. Given an existing ArrayList named contactList, find the number of contacts in the…
A: According to the question below the solution: Output:
Q: 1) What is one main disadvantage of an ArrayList? 2) Write a Java statement to create an ArrayList…
A: Given:
Q: A teacher has five students who have taken four tests. The teacher uses the following grading scale…
A: #include <iostream> using namespace std; int main(){ string names[5];char…
Q: Complete the following problem using concepts of Key index searching,sorting and hashing
A: import java.util.*; class GFG { public static void main(String args[]) {…
Q: Provide a method addAttempt(int stId, String stName, double marks) a. This method creates an…
A: import java.util.*; public class Main{ public static void main(String[] args){ //create an…
Q: Create an abstract class called GeometricFigure. Each figure includes a height, a width, a figure…
A: public class UseGeometric{ public static void main (String[] args) { Square s1=new…
Q: Submission Instructions Follow the instructions for How to Submit Programming Assignments.…
A: Following is the java program which takes as input string of integers from command line and save it…
Q: Create class FeesPayment with the data members Student Register number, Amount, Date and mode of…
A: public class Accountant {private int id;private String name,password,email,contactno;public…
Q: At least 1 loop An Array or ArrayList At least 3 Java classes Use methods I am trying to make it so…
A: In questions with multiple questions we must answer 1.
Q: JAVA Create a class called 'Matrix' containing constructor that initializes the number of rows…
A: A class “Mat” for Matrix is created containing constructor which initializes the no of rows and…
Q: Create a Keylndex class with the following properties : Fields: int [ ] k; Description An array of…
A: ANSWER:-
Q: Javascript Create an object, Gremlin, that extends the Monster interface and takes the same…
A: ** Modified / New code is highlighted in bold.** class Monster { constructor(language){…
Q: Non of LI QUESTION 14 Which of the following is a reason to use an ArrayList instead of an array? O…
A: Given question about the comparison of ArrayList and array
Q: Design and implement a Java class named Book with two data members: title and price. The class…
A: Class Book contains basic details about book and getter/setter method. Class BookShelf contains an…
Data structure & Algrothium java program
Create the three following classes:
1. class containing two strings attributes first name and last name.
2. class containing the name object and an ArrayList of string to store the list gifts. This class would extend the attached NicePersonInterface.java
3. class containing one ArrayList of Names to store the naughty names. Another ArrayList of NicePerson to store the nice names and gifts. Add atleast 4 names in each list and display all information.
Step by step
Solved in 3 steps
- import java.util.ArrayList; /** * This class describes a user of Twitter. A user has a user ID * (e.g. @testudo), a list of tweets, a count of the number of followers, * and a list of users that this user follows. Unlike P5, * there is no upper limit on the number of tweets or users to follow. * * You may NOT import any library class other than java.util.ArrayList. * You may NOT add any instance variables to keep a count of the number * of tweets or users being followed. You may add instance variables * for other purposes as long as they are private. */public class TwitterUser { private String userID; private int followers; private ArrayList<Tweet> listTweets; private ArrayList<TwitterUser> toFollow; /** * A constructor that takes the user's ID. If the ID is null, or * longer than 32 characters, or it does not start with "@", * throw an IllegalArgumentException. * * All other instance variables should be initialized…Please fill in all the code gaps if possible: (java) public class LinkedListNode { private Object date; private LinkedListNode next; // Constructor: public LinkedListNode (Object data) // You also need to define the getter and setter: public LinkedListNode getNext() public void setNext (LinkedListNode next) public Object getData() public void setData(Object data) }Exercise 2. Create a Book class where: Each book contains the following information: book title book Author name, barcode (as fong integers), and book topic. o Implement an appropriate constructor(s) and all necessary get/set methods. Test Book class: o Create diffcrent book objects (at least 5 hooks) and store them in a LinkedList sorted by book barcode value Generate a unique random integer value for the barcode. Iterate through the LinkedList and print out the books' details O Create a second LinkedList object containing a copy of the above LinkedList, but in reverse order.
- import java.io.*;import java.util.*; public class Client { private ArrayList<Student> students;private String dealWithType;public Client() {students = new ArrayList<Student> ();dealWithType = "coursework";dealWithType = "research";readStudent();readResult();}public void run() {for(Student s : students) {s.display();System.out.println();} } private void readResult() {for(Student s : students) {try {String data = getResultData(s.getId());if(data.equals("")) {throw new StudentNotFoundException(s.getId());}s.setData(data);}catch(StudentNotFoundException ex){System.out.println(ex);System.out.println();}}} private String getResultData(long id) {String toReturnLine = "";try {Scanner file = new Scanner(new File(dealWithType+".csv"));// read in header and throw awayfile.nextLine();while (file.hasNextLine()) {String line = file.nextLine();String[] data = line.split(",");long studentID = Long.parseLong(data[0]);if(studentID == id) {toReturnLine =…Create a class “Node” which is a single node of a singly linked list. The node stores an integer datatype. The class has two data members, an integer and pointer to the same Node class.Implement the following methods:1. The default constructor: Set value of the data member to zero2. A parameterized constructor: Node(int a); takes an integer variable and assigns it to the data member of this object. Set next pointer to NULL.3. Node* GetNextPointer() const; Retun next pointer of this Node4. void SetNextPointer(Node *ptr); Set the next pointer of this node to the ptr that is passed to the function.5. void SetData(int a); Set data of this node equal to ‘a’6. int GetData() const; returns the data of this object.The data member are private whereas the methods are public. part 4 5 and 6 In c++.Create a class “Node” which is a single node of a singly linked list. The node stores an integer datatype. The class has two data members, an integer and pointer to the same Node class. Implement the following methods:1. The default constructor: Set value of the data member to zero2. A parameterized constructor: Node(int a); takes an integer variable and assigns it to the data member of this object. Set next pointer to NULL.3. Node* GetNextPointer() const; Retun next pointer of this Node4. void SetNextPointer(Node *ptr); Set the next pointer of this node to the ptr that is passed to the function.5. void SetData(int a); Set data of this node equal to ‘a’6. int GetData() const; returns the data of this object.The data member are private whereas the methods are public.
- In java A supermarket wants to reward its best customer of each day, showing the customer’s name on a screen in the supermarket. For that purpose, the store keeps an ArrayList.Create a class customer having id, name, gender, and bill provide appropriate getters/setters and constructors also provide toString method.In the Store class, make an ArrayList of customers, store name, and address implement methods public void addSale(Customer c) that will add customers to the arraylist.public void RemoveCustomer(int id);public void UpdateCustomerRecord(int Id);public displayAll();public String nameOfBestCustomer() to record the sale and return the name of the customer with the largest sale. public ArrayList nameOfBestCustomers(int topN) so that it displays the top customers, that is, the topN customers with the largest sales, where topN is a value that the user of the program supplies. Write a program that prompts following menu and ============================================…Assignment1: Analyse the case study given in chapter 3 Linked listAnswer the following questions from Library.java1. Write the different class names with class keyword2. Write the different methods using public and private keywords3. Write the class names with extends keyword linkedlist4. Write import statements used in library.java5. Write the main method chapter 3 Linked list : https://drive.google.com/file/d/1NRN_3Fx3smkjwv1jgG8hzaiGfnNfeeDb/view?usp=sharingDynamic Apex: Write test class for this apex code(Not required the output) You are working on the project in which you have to create the apex code in which your task is to define the objects dynamically by using the method argument which is api name in string and a map of string, string as a key value pair. Class Code: public static void modifySobjectData(String str , Map mapofString) { //Retrive the type of Sobject by using the getGlobalDescribe Schema.SobjectType targetType = Schema.getGlobalDescribe().get(str); //Initalize the Object Sobject newobject = targetType.newSobject(); for(String s :mapofString.keySet(O) { newobject.put(s, mapofString.get(s)); } System.debug('newObject' + newobject); //Perform the DML if(targetType != null) insert newobject; } }
- Implement the following tasks by using concepts of object-oriented programming (Java). i. Create a generic class with a type parameter that simulates drawing an item at random out of a box. This class could be used for simulating a random drawing. For example, the box might contain Strings representing names written on a slip of paper, or the box might contain Integers representing a random drawing for a lottery based on numeric lottery picks. Create an add method that allows the user of the class to add an object of the specified type along with an isEmpty method that determines whether or not the box is empty. Finally, your class should have a drawItem method that randomly selects an object from the box and returns it. If the user attempts to drawn an item out of an empty box, return null. Write a main method that tests your class.ii. The following is a short snippet of code that simulates rolling a 6-sided dice 100 times. There is an equal chance of rolling any digit from 1 to…2) Suppose you have a linked list class that provides the following methods: // constructor. // returns size of the list. LinkList () int size (); void insertHead (Object data) // insert new data at the head of // the list. // remove and return the Object at // the head of the list. Object removeHead () void insertTail (Object data) // insert new data at the tail of // the list. The class below is an implementation of a stack using the linked list class. Fill in the method implementations: class Stack { private Stack s; public Stack () { public void push (Object x) { } public Object pop () // assume stack is not empty { } public boolean isEmpty() { }Q1: Write the Java code corresponding to the following UML diagram. The class School implements the interface Building. The method computeArea returns the area of the building as width * length. After that, add a testing class with a main method which defines an arrayList that contains three objects. From the main method, print the area of all the three objects.