U2L4 FS
.pdf
keyboard_arrow_up
School
Rowan College, Burlington County *
*We aren’t endorsed by this school
Course
111
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
2
Uploaded by MagistrateDiscoveryKangaroo81
9/30/21, 11:43 AM
Quiz: Unit 2: Lesson 4 - Fast Start
https://courses.projectstem.org/courses/10083/quizzes/220983/take
1/2
Unit 2: Lesson 4 - Fast Start
Started: Sep 30 at 11:42am
Quiz Instructions
In the first few lessons of this unit, we learned what a class data type was. Now we will explore in greater
depth what we mean by a "class" and an "object".
Before you start today, be sure you feel comfortable with the following topics:
String functions -
Unit 2: Lesson 3
Class data types -
Unit 2: Lesson 1
1 pts
Question 1
lement
emen
ement
leme
lemen
Suppose the String s is declared and initialized as follows:
String s = "elementary";
What String would be returned by the method call
s.substring(2, 6);
?
1 pts
Question 2
What will be printed by the following code?
String s = "Animal";
System.out.println(s.indexOf("an"));
9/30/21, 11:43 AM
Quiz: Unit 2: Lesson 4 - Fast Start
https://courses.projectstem.org/courses/10083/quizzes/220983/take
2/2
Not saved
0
-1
1
false
Nothing is printed, an error occurs
1 pts
Question 3
s1 and s2 are identical strings
s1 appears before s2 alphabetically
s1 appears after s2 alphabetically
Suppose s1 and s2 are Strings and the following code is run:
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();
System.out.println(s1.compareTo(s2));
If the code causes -25 to be output, which of the following must be true
Submit Quiz
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
The purpose of this exercise is to allow the student to demonstrate their understanding of application development, the creation and use of classes and objects in Python, and using the other tools (selection, iterations, functions, etc.) we have learned this term. We will make a simple game called 'Stray Cat Strut'
- Using the grid class discussed in Chapter 9, create a 20 x 20 cell game board- This game board represents a backyard- Create a class called animal with two attributes:-- an attribute called 'location' which is a grid coordinate (e.g., B3)-- an attribute called 'lives' which is an integer.- The animal class has the standard methods (init, str, etc.) plus one additional method:-- a method called 'move' that changes the animal's location one cell up (N), one cell right (E), one cell down (S), or one cell left (W). - Extend the animal class to a subclass called cat, and another subclass called dog- cat inherits the animal attributes and methods, but also has the following…
arrow_forward
plz draw uml and implemnt classes
arrow_forward
Python programming
Implement a constructor for the Person class
Implement a constructor for the Student class
Create a student with name; Albert Einstein, ramq: 14031879-1235, address: 112 Mercer Street, Princeton, courses: (1)Physics & (2)Relativity where the grades were b and a respectively and with enrollment date: 1895
arrow_forward
python programming
Implement a constructor for the Person class
Implement a constructor for the Student class
Create a student with name; Albert Einstein, ramq: 14031879-1235, address: 112 Mercer Street, Princeton, courses: (1)Physics & (2)Relativity where the grades were b and a respectively and with enrollment date: 1895
partial solution attached in the image
arrow_forward
Write a C# program that uses a class called ClassRegistration as outlined below:
The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate.
Responsibilities of the ClassRegistration class:
It is responsible for storing the student id numbers for a particular class (in an array of integers)
It is responsible for adding new student id numbers to this list (returns boolean)
It is responsible for checking if a student id is in the list (returns a boolean)
It is responsible for getting a list of all students in the class (returns a string).
It is responsible for returning the number of students registered for the class (returns an integer)
It is responsible for returning the maximum number of students the class is allowed (returns an integer)
It is responsible for returning the name of the class. (returns a string)
arrow_forward
Write a C#program that uses a class called ClassRegistration as outlined below:
The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate.
Responsibilities of the ClassRegistration class:
It is responsible for storing the student id numbers for a particular class (in an array of integers)
It is responsible for adding new student id numbers to this list (returns boolean)
It is responsible for checking if a student id is in the list (returns a boolean)
It is responsible for getting a list of all students in the class (returns a string).
It is responsible for returning the number of students registered for the class (returns an integer)
It is responsible for returning the maximum number of students the class is allowed (returns an integer)
It is responsible for returning the name of the class. (returns a string)
ClassRegistration
-…
arrow_forward
A library wants to manage its collection of books and authors more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented:
Create an Author class with the attributes: name, dob (date of birth), and nationality. The class should have a __str__ method to represent the author in a user-friendly format.
Create a Book class with the following attributes: title, author (an instance of the Author class), publication_date, and price. Also, include a class variable all_books that keeps a list of all book instances created.The Book class should have:
A __str__ method to represent the book in a user-friendly format.
A __eq__ method to compare two books. Two books are considered the same if they have the same title and author.
A __lt__ method to compare two books based on their publication dates.
A class method get_all_books that returns a list of all books in the library.
A static method most_expensive_book that takes…
arrow_forward
A library wants to manage its collection of books and authors more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented:
Create an Author class with the attributes: name, dob (date of birth), and nationality. The class should have a __str__ method to represent the author in a user-friendly format.
Create a Book class with the following attributes: title, author (an instance of the Author class), publication_date, and price. Also, include a class variable all_books that keeps a list of all book instances created.The Book class should have:
A __str__ method to represent the book in a user-friendly format.
A __eq__ method to compare two books. Two books are considered the same if they have the same title and author.
A __lt__ method to compare two books based on their publication dates.
A class method get_all_books that returns a list of all books in the library.
A static method most_expensive_book that takes…
arrow_forward
Part d
arrow_forward
Problem C
• -3: method consonants() had more than one loop
• -3: method initials () had more than one loop
• -3: at least one method used nested loops
arrow_forward
Search for textbooks, step-by-step expl
= bartleby
e Q&A Library
Design a class nam
Start your trial
Design a class named MyPoint to represent a point with
X-and y-coordinates. The class contains:
The data fields x and y that represent the coordinates with getter methods.
A no-arg constructor that creates a point (0, 0).
A constructor that constructs a point with specified coordinates.
A method named distance that returns the distance from this point to a
specified point of the MyPoint type.
A method named distance that returns the distance from this point to
another point with specified x- and y-coordinates.
A static method named distance that returns the distance from two MyPoint
objects.
Draw the UML diagram for the class then implement the class. Write a test
program that creates the two points (0, 0) and (10, 30.5) and displays the distance
between them.
O16
W
MacR eok
arrow_forward
Python OOP (Check pictures for instructions)Code Template to be used in this link:https://pastebin.com/aikCrFyj
arrow_forward
data structures in java
arrow_forward
Make a class Student. The Student class has data members such a sroll
number, name, branch. Create a class called Exam that has data
members roll number and six subject marks. Derive the result class
from Student and Exam it has own data members such a total mark,
and result. Write a Java program to model the relationships.
arrow_forward
Problem You want to implement a custom class that mimics the behavior of a common built-in container type, such as a list or dictionary. However, you're not entirely sure what methods need to be implemented to do it.
arrow_forward
Instructor note:
This lab is part of the assignment for this chapter.
This lab uses two Java files, LabProgram.java and SimpleCar.java. The SimpleCar class has been developed and provided to you already. You don't need to change anything in that class. Your job is to use the SimpleCar class to complete the specified tasks in the main() method of LabProgram.java
Given two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar object that performs the following operations:
Drives input number of miles forward
Drives input number of miles in reverse
Honks the horn
Reports car status
The SimpleCar class is found in the file SimpleCar.java.
Ex: If the input is:
100 4
the output is:
beep beep Car has driven: 96 miles
arrow_forward
7-2 Discussion: Interpreting Multiple Regression Models
Previous Next
In this discussion, you will apply the statistical concepts and techniques covered in this week's reading about multiple regression. You will not be completing work in Jupyter Notebook this week. Instead, you will be interpreting output from your Python scripts for the Module Six discussion. If you did not complete the Module Six discussion, please complete that before working on this assignment.
Last week's discussion involved development of a multiple regression model that used miles per gallon as a response variable. Weight and horsepower were predictor variables. You performed an overall F-test to evaluate the significance of your model. This week, you will evaluate the significance of individual predictors. You will use output of Python script from Module Six to perform individual t-tests for each predictor variable. Specifically, you will look at Step 5 of the Python script to answer…
arrow_forward
Use java programming language
1.1 Create a Student Object project.
Create a Student class and use the provided UML diagram to code the instance fields, constructors and methods.
Note:
The module mark is the average of the participation mark and the examination mark - calculate this using the calcModuleMark() method.
The determineStNumber() method should compile a student number with the first 3 letters of the student's name, a '#' symbol, and a 3-digit randomly generated number (make use of a for-loop to concatenate these 3-digits).
The stNumber data field should be set in the constructor by calling the determineStNumber() method.
The toString() method must compile a string to display the student number, participation mark, examination mark, and module mark, formatted in table format.
Student number PMark EMark MMark
Mar#9186 81 64 72.00
1.2 Create a testStudents class. Do the following:
-Write a static method called display() which receives…
arrow_forward
Implement a C++ program:RESTAURANT that has multiple branches, and each branch has menus of food items, their stock and a list of customers. A branch may have for example a breakfast menu and lunch menu with different food items, and the stock (available quantity) of each food item in the branch. Also, the branch will have a list of regular customers and their contact information to contact them for offers and new food items. Class Names Data and Member Functions
Food Data Members: ID, Name, Calories, Price Member Functions: getID, getName, getCalories, getPrice setID, setName, setCalories, setPrice
Stock Data Members: ID, Food, Stock Member Functions: getID, getFood, getStock setID, setFood, setStock
Customer Data Members: ID, Name, Phone Member Functions: getID, getName, getPhone setID, setName, setPhoe
Menu Data Members: ID, Name, foodList Member Functions: getID, getName, getFoodList setID, setName
Branch Data Members: ID, Address, menuList, stockList, customerList Member…
arrow_forward
You have been asked to design the framework for defining different types of computers. For example, there are Laptops, Servers, and SmartPhones that are all a type of Computer.Use the following rules to answer the questions that follow:A Server is a type of Computer that has a Ethernet interface.A Laptop is a type of Computer that has a Battery and also has a Ethernet and Wifi interface.A SmartPhone is a type of Computer that has a Battery, a Call method and a Wifi interface.A Network interface is an interface that allows an object to connect to a network.A Ethernet interface is a type of Network interface.A Wifi interface is a type of Network interface.
Write the code below for the Computer class. The Computer class must be an abstract class, and have the following methods and attributes:
a public string called HostName
a private int called MemorySize
a public abstract method called shutdown that takes no arguments and returns nothing
a public abstract method called runProgram that…
arrow_forward
Java
Please help
arrow_forward
java-Math is a class and the following notation is correct:
Math.sqrt(4.77);
what you can tell from notation:
sqrt is a per-object method
sqrt is a per-class method
sqrt is a per-class data field
sqrt is a per-object data field
arrow_forward
implement the following class diagrams and test their method .Write this code on java
arrow_forward
Using the scenario of Object oriented programming
Q1 Write a program that defines a class with a data member to holds a “serial number” for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this, you’ll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each about its serial number. They should respond I am object number 2, and so on.
arrow_forward
You are to create a solution for a Pharmaceutical company.
Entities to be represented are: Drugs, Sales Representatives, Bills and Vouchers.
• A Drug is characterized by its name (string), its price (int) and its manufacturer (a
manufacturer ===> composition).
A Manufacturer is characterized by his name (string) and the list of drugs they sell (array
of drugs) => composition.
• A Sales Representative (sometimes referred to as rep) is characterized by his/her
name(string), the total amount sold (double), his/her salary (int).
o Sales Representatives can be of two types (inheritance):
Reps with a fixed income and a commission
Reps with a commission only
A Voucher is characterized by its number (int), a client name (a customer), and the quantity
sold of each drug.
All reps and vouchers and bills are payable. As such, students need to implement
an interface called Payable and implement it in the aforementioned classes.
1. You need then to create GUI interfaces where the user can manage all…
arrow_forward
Encapsulation in Java
Implement getters and setters for the class in the code editor. Ask the user input for each attribute and use the setters to set the attributes.
Inputs
1. Game Name
2. Year Published
3. Game Publisher
Sample Output
Enter game name: Genshin Impact
Enter year published: 2020
Enter game publisher: Hoyoverse
Genshin Impact is published on 2020 by Hoyoverse.
arrow_forward
In Python,
#Create a basket class, which has a class/static attribute pricelist (string/float dictionary - you can hardcode this)
#The constructor should set the name to the name passed as a parameter and initialise the contents (empty)
#You should provide an addItem method taking product,quantity which adds this to the contents
#and a getQuantity method taking a product, which returns the relevant quantity
arrow_forward
Using the Python language answer the following questions below. Please tell me what program you use if it is IDLE or Atom or a python website please provide the website you use.
arrow_forward
*python coding please
Write a class named Person with data attributes for a person’s name, address, and telephone number. Next, write a class named Customer that is a subclass of the Person class. The Customer class should have a data attribute for a customer numberand a Boolean data attribute indicating whether the customer wishes to be on a mailing list. Demonstrate an instance of the Customer class in a simple program.
arrow_forward
What does it mean to have a disjoint type? I'd want to see an example of this.
arrow_forward
Write the Movie class. The UML diagram of the class is represented below:
1. Implement the class strictly according to its UML one-to-one (do not include anythingextra, and do not miss any data fields or methods). 2. Implement a MovieTest class to test the class Movie you just created.• Create two Movie objects: one using the no-args constructor and one from theconstructor with all fields.• Print the contents of both objects. Please submit a screenshot. Hint: toString()method.
arrow_forward
Task 2: General AbstractsFor this task you will be asked to create the Java classes described in the UMLdiagram in Task 1.Instructions1. The class Person has the following implementations in addition to thosespecified above:• the dateOfBirth attribute is of type java.util.Date• public getter methods for the attributes• a public constructor Person with the following method signature:public Person(String idNumber, String name, Date dateOfBirth)• declare an abstract compareTo method in Person with the followingsignature:public int compareTo(Person p);2. The class called VaccineRecord has the following extra details:• the enum called VaccineType has the following possible values:JJ,AZ,MD,PF• the public constructor for the VaccineRecord has the following signa-ture:public VaccineRecord(VaccineType type, String batchCode);• the date attribute is of type java.util.Date3. The class called Patient that extends the Person class has the followingadditional attributes and behaviours:• the public…
arrow_forward
Object Oriented Programming: 213COMP, 214COMP (Feb-2022)
Assignment- I [10 marks]
Academic honesty:
O Only pdf file accepted & student ID, will be your upload file.
O Student who submit copied work will obtain a mark of zero.
O Late work or attach file by email message not allowed.
Q1: Write the signature for a method that has one parameter of type String, and does
not return a value.
Q2: Write the signature for a method that has two parameters, both of type Student,
and returns an int value.
Q3: Write the constructor's headers of the followings?
new Student (202101156, “Ahmed");
new Address(51, "jazan university","CS&IT" );
new Grade(true, 505235600, 4.5);
Q4:
a) Write a class Student that define the following information:
name, stid , age.
b) Explain a mutators (setters) and accessors(getters) methods for each
attributes(fields).
c) Add three constructors:
• with empty constructor.
one parameter constructor (name of student)
two parameters constructor (name and stid)
d) Create two…
arrow_forward
language is c++
sample output included with user input in bold
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
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
Related Questions
- The purpose of this exercise is to allow the student to demonstrate their understanding of application development, the creation and use of classes and objects in Python, and using the other tools (selection, iterations, functions, etc.) we have learned this term. We will make a simple game called 'Stray Cat Strut' - Using the grid class discussed in Chapter 9, create a 20 x 20 cell game board- This game board represents a backyard- Create a class called animal with two attributes:-- an attribute called 'location' which is a grid coordinate (e.g., B3)-- an attribute called 'lives' which is an integer.- The animal class has the standard methods (init, str, etc.) plus one additional method:-- a method called 'move' that changes the animal's location one cell up (N), one cell right (E), one cell down (S), or one cell left (W). - Extend the animal class to a subclass called cat, and another subclass called dog- cat inherits the animal attributes and methods, but also has the following…arrow_forwardplz draw uml and implemnt classesarrow_forwardPython programming Implement a constructor for the Person class Implement a constructor for the Student class Create a student with name; Albert Einstein, ramq: 14031879-1235, address: 112 Mercer Street, Princeton, courses: (1)Physics & (2)Relativity where the grades were b and a respectively and with enrollment date: 1895arrow_forward
- python programming Implement a constructor for the Person class Implement a constructor for the Student class Create a student with name; Albert Einstein, ramq: 14031879-1235, address: 112 Mercer Street, Princeton, courses: (1)Physics & (2)Relativity where the grades were b and a respectively and with enrollment date: 1895 partial solution attached in the imagearrow_forwardWrite a C# program that uses a class called ClassRegistration as outlined below: The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate. Responsibilities of the ClassRegistration class: It is responsible for storing the student id numbers for a particular class (in an array of integers) It is responsible for adding new student id numbers to this list (returns boolean) It is responsible for checking if a student id is in the list (returns a boolean) It is responsible for getting a list of all students in the class (returns a string). It is responsible for returning the number of students registered for the class (returns an integer) It is responsible for returning the maximum number of students the class is allowed (returns an integer) It is responsible for returning the name of the class. (returns a string)arrow_forwardWrite a C#program that uses a class called ClassRegistration as outlined below: The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate. Responsibilities of the ClassRegistration class: It is responsible for storing the student id numbers for a particular class (in an array of integers) It is responsible for adding new student id numbers to this list (returns boolean) It is responsible for checking if a student id is in the list (returns a boolean) It is responsible for getting a list of all students in the class (returns a string). It is responsible for returning the number of students registered for the class (returns an integer) It is responsible for returning the maximum number of students the class is allowed (returns an integer) It is responsible for returning the name of the class. (returns a string) ClassRegistration -…arrow_forward
- A library wants to manage its collection of books and authors more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented: Create an Author class with the attributes: name, dob (date of birth), and nationality. The class should have a __str__ method to represent the author in a user-friendly format. Create a Book class with the following attributes: title, author (an instance of the Author class), publication_date, and price. Also, include a class variable all_books that keeps a list of all book instances created.The Book class should have: A __str__ method to represent the book in a user-friendly format. A __eq__ method to compare two books. Two books are considered the same if they have the same title and author. A __lt__ method to compare two books based on their publication dates. A class method get_all_books that returns a list of all books in the library. A static method most_expensive_book that takes…arrow_forwardA library wants to manage its collection of books and authors more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented: Create an Author class with the attributes: name, dob (date of birth), and nationality. The class should have a __str__ method to represent the author in a user-friendly format. Create a Book class with the following attributes: title, author (an instance of the Author class), publication_date, and price. Also, include a class variable all_books that keeps a list of all book instances created.The Book class should have: A __str__ method to represent the book in a user-friendly format. A __eq__ method to compare two books. Two books are considered the same if they have the same title and author. A __lt__ method to compare two books based on their publication dates. A class method get_all_books that returns a list of all books in the library. A static method most_expensive_book that takes…arrow_forwardPart darrow_forward
- Problem C • -3: method consonants() had more than one loop • -3: method initials () had more than one loop • -3: at least one method used nested loopsarrow_forwardSearch for textbooks, step-by-step expl = bartleby e Q&A Library Design a class nam Start your trial Design a class named MyPoint to represent a point with X-and y-coordinates. The class contains: The data fields x and y that represent the coordinates with getter methods. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. A method named distance that returns the distance from this point to a specified point of the MyPoint type. A method named distance that returns the distance from this point to another point with specified x- and y-coordinates. A static method named distance that returns the distance from two MyPoint objects. Draw the UML diagram for the class then implement the class. Write a test program that creates the two points (0, 0) and (10, 30.5) and displays the distance between them. O16 W MacR eokarrow_forwardPython OOP (Check pictures for instructions)Code Template to be used in this link:https://pastebin.com/aikCrFyjarrow_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