The appropriate comments at the Beginning of each file with the information about the filename, author, and date. Finally, zip the folder Chap10b and upload it for submission.
The Homework Assignment Chapter 10b, you need to create four Java files: Vehicle.java, Car.java, Motorcycle.java, and UseVehicle.java. The Vehicle class is a superclass for vehicle types and contains private data fields for the number of wheels and the average number of miles per gallon, getters and setters for these fields, a constructor with integer arguments for the number of wheels and average miles per gallon, and a display() method that prints the required output.The Car and Motorcycle classes extend the Vehicle class and have constructors that accept the miles-per-gallon value as an argument and force the number of wheels to the appropriate value, 4 for a Car and 2 for a Motorcycle, respectively. Use the superclass constructor to set the wheels and mpg data fields by using the super keyword.The UseVehicle class should instantiate one object of each subclass and display their values by calling the display() method. The output should show "Car--> Wheels: 4 Mpg: 30" and "Motorcycle--> Wheels: 2 Mpg: 60".
Make sure to include the appropriate comments at the beginning of each file with the information about the filename, author, and date. Finally, zip the folder Chap10b and upload it for submission.
To know more about Beginning.
https://brainly.com/question/7788080
#SPJ11
/ Vehicle.java
// Author: [Your Name]
// Date: [Current Date]
public class Vehicle {
private int numWheels;
private int avgMpg;
public Vehicle(int wheels, int mpg) {
this.numWheels = wheels;
this.avgMpg = mpg;
}
public int getNumWheels() {
return this.numWheels;
}
public int getAvgMpg() {
return this.avgMpg;
}
public void setNumWheels(int wheels) {
this.numWheels = wheels;
}
public void setAvgMpg(int mpg) {
this.avgMpg = mpg;
}
public void display() {
System.out.println("Wheels: " + this.numWheels + " Mpg: " + this.avgMpg);
}
}
// Car.java
// Author: [Your Name]
// Date: [Current Date]
public class Car extends Vehicle {
public Car(int mpg) {
super(4, mpg);
}
}
// MotorCycle.java
// Author: [Your Name]
// Date: [Current Date]
public class MotorCycle extends Vehicle {
public MotorCycle(int mpg) {
super(2, mpg);
}
}
// UseVehicle.java
// Author: [Your Name]
// Date: [Current Date]
public class UseVehicle {
public static void main(String[] args) {
Car myCar = new Car(30);
MotorCycle myMotorCycle = new MotorCycle(60);
System.out.print("Car --> ");
myCar.display();
System.out.print("Motorcycle --> ");
myMotorCycle.display();
}
}
// Output:
// Car --> Wheels: 4 Mpg: 30
// Motorcycle --> Wheels: 2 Mpg: 60
Learn more about Vehicle here:
https://brainly.com/question/31842762
#SPJ11
Which of the following are electrical hazards shock explosions burns fire arc flash electrocution?
Electric shock, burns, electrocution (which can be lethal), and falls are the four basic categories of injuries. These accidents may occur in a number of ways: direct touch with circuit components or exposed electrified wires.
shock: The body's reaction to an electric current flowing through it. Burns are caused by the heat and harsh light that an arc flash or blast emits. Fire: Occurs with damaged switches, wires, and outlets. Explosions occur when electrical energy ignites explosives in the atmosphere. The primary risks associated with electricity are shock and burns from coming into touch with live components. Faults that might start fires or explosions; fires or explosions when electricity might be the source of ignition in a potentially explosive or flammable environment, such as in a spray paint booth.
To learn more about electrocution click the link below:
brainly.com/question/29861244
#SPJ4
Emma is creating a database to track sales. She wants to be able to sort by price and sales associate. And she would like to look up the barcode number and the description. What fields should she have in her database?.
Emma should have barcode number, description, price, and sales associate fields in her database.
What is field in database?A database is a collection of information that has been organized for easy access, management, and updating. Computer databases are typically used to store aggregations of data records or files containing information such as sales transactions, customer data, financials, and product information.A field database is one in which the data under information, email address, and phone number are stored in a field of a row that can also contain other fields such as address or city information in a table named customer contact.The fields are represented by the columns. The field will correspond to data such as ID, color, and postcode. For example, if you have a customer record that includes their name, address, and phone number, each of those pieces of information is considered a field.The complete question:
"Emma is creating a database to track sales. She wants to be able to sort by price and sales associate. And she would like to look up the barcode number and the description. What fields should she have in her database?
1.sales associate and barcode number
2.sales associate, price, and description
3.barcode number, description, price, and sales associate
4.product number, description, price, sales associate, and profit."
To learn more about database refer to :
https://brainly.com/question/518894
#SPJ4
How to fix "files required to play gta online could not be downloaded from the rockstar games service"?
Answer:
Check the Rockstar Games Service Status for server outages or scheduled maintenance. You can reset your router by unplugging it and leaving it unplugged for about 10 minutes. Restart the game client and check to see if your issue is resolved.
how many different values can be represented using 4 bits?
16 different values can be represented using 4 bits. In digital electronics and computer science, a bit is a basic unit of information that can have two values, typically represented as 0 or 1.
The number of different values that can be represented using a certain number of bits is determined by 2 raised to the power of the number of bits. Bits are used to store and process data in computers and other digital devices, and they are the building blocks of all digital information. For example, the text of this message, the images and videos you see on your screen, and the music you listen to are all represented by a series of bits. They are also used in digital communications, such as data transmission over a network or the internet, where data is sent as a series of ones and zeroes.
In the case of 4 bits, the number of different values that can be represented is 2 raised to the power of 4, which is equal to:
2 x 2 x 2 x 2 = 16.
Therefore, 4 bits can represent 16 different values, ranging from 0 to 15 in decimal form.
Learn more about bit value, here https://brainly.com/question/14805132
#SPJ4
How does lower latency benefit the users connected to a network?
Users connected to a network benefit from lower latency "by reducing the delay when sending and receiving data between devices". The correct answer is C.
Lower latency refers to the amount of time it takes for data to be sent and received between devices on a network. When latency is low, the delay between when a user sends a request and when they receive a response is minimized, resulting in a more responsive and smoother experience for the user. This is particularly important in applications such as online gaming, video conferencing, and real-time control systems, where fast response times are critical. A low-latency network allows for faster data transfer, which results in a better user experience.
This question should be provided with answer choices, which are:
(A) by expanding the range over which the network's signals are transmitted.(B) by enabling more devices to connect to the network at the same time.(C) by reducing the delay when sending and receiving data between devices.(E) by limiting network access to users with higher security credentials.The correct answer is C.
Learn more about high latency here: brainly.com/question/30185656
#SPJ4
A private server wants to reach URL https://www.amazon.com through a NAT device. Please select the answer which best describes how the packet would look on the private server. Please note the following before answering question:
Private System has Private IP: 192.168.0.5
NAT has Private IP: 192.168.0.9 and Public IP: 52.25.13.28
Assume the destination domain name resolves to Public IP: 54.239.17.6
O Source IP: 192.168.0.5, Source Port 45678, Destination IP: 54.239.17.6, Destination Port 443
O Source IP: 192.168.0.5, Source Port 443, Destination IP: 54.239.17.6. Detination Port 443
O Source IP: 192.168.0.5, Source Port 56789, Destination IP: 52.25.13.28, Destination Port 443
O Source IP: 192.168.0.5, Source Port Bo, Destination IP: 54.239.17.6, Destination Port 80
Given that Private server's IP address is 192.168.0.5, that will act as the source IP address.
What functions do private servers have?A private server is a real computer that you own and manage and has all the necessary operating systems, programs, and software installed to offer key services, like email. Need a dictionary definition A physical or virtual device that is managed privately is referred to as a private server.
The legality of private servers?Playing on a private server is it permitted, While hosting one can be against the law, using one is not. Playing on a real server won't get you in trouble because all the legal problems are packed up on simulating a server and disseminating the client.
To know more about IP address visit :-
https://brainly.com/question/16011753
#SPJ4
Which computer memory is higher among digital & analog computer
7.3.5 Compare an MD5 Hash CIT 180 lab.
The MD5 hash will always be a 128-bit length. The hash calculation includes a step called padding, which converts a single letter into a 32-character output.
Why is MD5 no longer advised for use?Since security experts have shown methods that can easily produce MD5 collisions on commercially available hardware, MD5 hashing, although initially created as a cryptographic message authentication code algorithm for use on the internet, is no longer thought to be trustworthy for use as a cryptographic checksum.
What makes SHA 512 superior to MD5?The system is further protected by the SHA-512 algorithm's far stronger hashing than MD5 since it makes it more difficult for an attacker to crack passwords.
To know more about Hash visit:-
https://brainly.com/question/29970427
#SPJ1
Why is trunking important to VLAN configuration?
It is possible to extend a VLAN throughout the network via VLAN trunking. Trunk connections are required to guarantee that VLAN signals are correctly separated
so that each may reach its designated destination when numerous VLANs are implemented throughout a network.
A network architecture known as trunking, which is often used in IT and telecommunications, effectively transfers data across several entities without the usage of one-to-one lines. A network trunk essentially transports various streams of signals to the appropriate areas, just like a tree trunk provides water to every branch and leaf. Trunking in networking often refers to link aggregation or virtual local area network (VLAN) trunking, a procedure that is essential to VLAN configuration, for managed services providers (MSPs). VoIP services, which some MSP clients may also be interested in, are particularly referred to as IP trunking.
A trunk is a single communication route that enables many entities at one end to communicate with the right entity at the other
Learn more about VLAN here:
https://brainly.com/question/14530025
#SPJ4
How to fix you may need an additional loader to handle the result of these loaders?
One option for fixing it is to emit less modern code, which will reduce the amount of configuration needed by consumers. For example, if you target ES6 using the following settings in tsconfig. json : { "target": "ES6", "lib": ["DOM", "ES6", "DOM.
An online game developer has an issue with its most popular game and must take the server offline. The company posts an update on its social media page. How is this a positive use of social networking?
A. It shares the company’s plans with competitors, making it transparent and honest.
B. It allows the users to share their experiences with the game on a different platform while the site is down.
Answer:
I guess it is B
Explanation:
because it allows the user to share their experience
Explain the functional organization of elements of a computer system
Answer:
main memory
control unit
Arithmetic and logical unit
Data can be retrieved fastest from :
a. registers
b. cache memory
c. RAM
d. HDMI
Data can be acquired from registrations the quickest, thus I'm attempting to retrieve user-specific information like first name, last name, and email. Utilizing this feature
add_action(‘user_registration_after_register_user_action’, ‘ur_get_form_fields’, 10, 3);
function ur_get_form_fields($form_data, $form_id, $user_id)
{
var_dump($form_data);
}
However, if I attempt to utilise the $form data, id, or user id variables, I get the message "Unexpected token A in JSON at position 0."
1. The same problem message appears even when all plugins are disabled and the default Twenty Nineteen WP theme is turned on.
2. The plugin is currently running version 1.8.8.
3. The first name, last name, email, and password boxes are all required.
A register essentially serves as a storage area for memory modules that transport data for the CPU (Central Processing Unit) to use right away for data processing. They may actually be found in the computer processor as processor registers and go by the name of memory registers as well.
Learn more about Data here:
https://brainly.com/question/11941925
#SPJ4
what is your favorite game?
Answer:
royale high and the sims 4
Explanation:
royale high:
cool customization optionsseasonal eventslots of different games to level upcons:
community doesnt know if they should like or hate the devs because they have been releasing bad updates and constantly pushing off new school releasesims 4
somewhat good customization optionsyou can do whatever you wantcons:
no good packs have been released latelynot the most inclusive customization for simsWhat are the steps when it comes to making a video game? What do you need to do to plan it, and when it comes to developing it?
Video game planning, preproduction, production, testing, pre-launch, launch, and post-launch are the seven stages of game development.
How is computer science used in game development?Utilizing programming languages, creating software, and utilizing artificial intelligence are all aspects of computer science that are used in game development. The ideal degree type for learning Computer Science and Game Development and Design is a Game Development or Game Design emphasis within a Computer Science degree.
The foundations of computer science and programming are used in the creation of video games. To create realistic effects, video games' modern graphics rendering frequently makes use of cutting-edge methods like ray tracing.
A degree in computer science is still a good option for people trying to break into this extremely competitive industry because technical proficiency is required for positions like game developers, software testers, and audio engineers. Video game software development is known as game programming, a subset of game development.
To learn more about development refer to :
https://brainly.com/question/24251696
#SPJ1
Let G1 and G2 be arbitrary context free languages and R an arbitrary regular language.Consider the following problems:(A) Is L(G1) = L(G2)?(B) Is L(G2) ≤ L(G1)?(C) Is L(G1) = R?Which of the problems are undecidable ?Choose the correct answer from the options given below:(A) only (B) only(A) and (B) only(A), (B) and (C)
If a context-free grammar produces all of a language's strings, that language is said to be a context-free language (CFL). L1 = anbn | n is a positive integer is a context-free language, for example.
How can contextlessness in grammar be demonstrated?If a formal grammar's production rules can be used regardless of the context of a nonterminal, it is said to be "context-free." The single nonterminal on the left side can always be replaced with the right side, regardless of the symbols that are around it. It differs from context-sensitive grammar because of this.
Is a language that is context-free finite?(1) Context-free languages are countably infinite in number. This is accurate since each description of a context-free language has a limited length, making the number of such descriptions countably limitless.
To know more about context visit:-
https://brainly.com/question/30163198
#SPJ4
which sorting algorithm has the best asymptotic runtime complexity?
The sorting algorithm with the best asymptotic runtime complexity is O(n log n), which is the average and worst-case time complexity of comparison-based sorting algorithms such as Merge Sort and Heap Sort. Other sorting algorithms such as Bucket Sort and Radix Sort have a time complexity of O(n) but they have certain limitations and are not as widely used.
Asymptotic runtime complexity refers to the amount of time that an algorithm takes to complete as the input size grows indefinitely. It is typically represented using big O notation, which describes the upper bound of the growth of the algorithm's running time.
The most common time complexities are:
O(1), which means the algorithm takes constant time regardless of the input size.O(n), which means the algorithm's running time is directly proportional to the input size.O(n log n), which means the algorithm's running time increases logarithmically with the input size.Learn more about algorithm, here https://brainly.com/question/22984934
#SPJ4
The definition of "Decision" is
*
A) Showing the steps to solve a problem.
B) The act of choosing an option.
C) Inputting numbers into a computer.
D) Creating options in a problem.
Answer:
The answer is letter B
Explanation:
ask your search engine lol
Attaching structures end to end is called
Attaching structures end to end is called stacking.
Stack (data structure)In computer science, a stack is a collection of objects that uses the LIFO (Last In First Out) principle, that is, the data that was last brought in will be the first to come out of the stack. The stack can be implemented as a linked or continuous representation (with fixed tables).
Stack features TOP is the designation for the topmost element of a stack The TOP element is the last element added The TOP elements are known adding and removing elements is always implemented in the TOP LIFOStack utilization:
Arithmetic expression penalty (posfix) backtracking algorithm recursive algorithmStack operations:
InsertFirst() usually called Push (input E : typeelmt, input/output data : stack): adds an element to the stack DeleteFirst () usually called Pop (output E : typeelmt, input/output data : stack ) : deletes the stack of elements IsEmpty () : checks if the stack is empty or if there are elements IsFull () : checks whether the stack is full or not Delete () : delete all data Peek () : view the TOP dataLearn more about stack at https://brainly.com/question/30023163.
#SPJ4
Stacking structures is the practice of attaching one set of structures to another set of structures end-to-end.
Stacking structures refers to the process of attaching multiple structures end-to-end in order to create a larger, more complex structure. This can be done in a variety of ways, such as by physically connecting the structures together or layering them on top of each other. This technique is often used in construction, engineering, and architecture to create taller buildings, larger structures, or to add additional floors or levels to a building. It can also be used in other fields, such as computer science, where multiple layers of a neural network can be stacked to improve performance.
Learn more about stacking structures here: brainly.com/question/13152669
#SPJ4
Which tag do you use to create a Paragraph in HTML?
*
A) body
B) p
C) h
D) li
Answer:
B: p because paragraph starts with P and <p>Hello World</p>.
How to fix incorrect permissions on windows search directories?
Answer:
Take ownership of the Data folder.
Run SFC and DISM scans.
Disable and re-enable the Windows Search feature via the Command Prompt.
Create a new user profile.
Describe the medieval inquisition an the spanish inquisition, making sure to clarfiy the differences between the two
The defining design element of Gothic architecture is the pointed or ogival arch.
Describe the medieval inquisition an the spanish inquisition?The Medieval Inquisition, also known as the Papal Inquisition, was an inquisition created by the Church in the 13th century to hunt out heresy. Pope Gregory IX established it. Inquisitors were mostly drawn from the Dominican and Franciscan orders and served as both investigators and judges.
The Spanish Inquisition was a procedure created by the Spanish kings Ferdinand and Isabella in the late 15th century to uphold Catholic orthodoxy in Spain.Thee Spanish Inquisition (which began in 1478) investigated whether Jews and Muslims had converted to Catholicism correctly.
To learn more about medieval inquisition to refer:
https://brainly.com/question/29304913
#SPJ4
An online retailer offers next-day shipping for an extra fee. The retailer says that 95\%95%95, percent of customers who pay for next-day shipping actually receive the item the next day, and those who don't are issued a refund. Suppose we take an srs of 202020 next-day orders, and let xxx represent the number of these orders that arrive the next day. Assume that the arrival statuses of orders are independent.
The probability of getting exactly 19 orders out of 20 next day is (20)(0.95)¹⁹ * (0.05). It means it is a very low chance of happening as it is a very small value.
The probability of P(X = 19) that we calculated represents the likelihood of exactly 19 out of 20 orders arriving the next day, given the stated probability of success (0.95) for next-day shipping. It is a measure of how likely it is that a specific outcome (19 out of 20 orders arriving the next day) will occur, given the assumptions of the problem (95% success rate and independence of trials). It is a decimal value between 0 and 1, with 0 indicating an impossible outcome and 1 indicating a certain outcome.
P(X = 19) = (20 choose 19) * (0.95)¹⁹ * (0.05)¹
= (20) * (0.95)¹⁹ * (0.05)
= (20)(0.95)¹⁹ * (0.05)
So the probability of getting exactly 19 orders out of 20 next day is (20)(0.95)¹⁹ * (0.05)
An online retailer offers next-day shipping for an extra fee. The retailer says that 95% of customers who pay for
next-day shipping actually receive the item the next day, and those who don't are issued a refund. Suppose we
take an SRS of 20 next day orders, and let X represent the number of these orders that arrive the next day.
Assume that the arrival statuses of orders are independent,
Which of the following would find P(X = 19)?
Choose 1 answer:
(20)¹⁹ (0.95)(0.05)¹⁹
(20)(0.95)¹⁹ * (0.05)
(20) (0.95)(0.05)
Learn more about probability, here https://brainly.com/question/30034780
#SPJ4
Answer:
( 20/19)(0.95)^19 (0.05)
Explanation:
Debugging Exercise 3-1 叩| Instructions DebugThree1. 1 // This class calculates a waitperson's tip as 15% of the bill 2 public class DebugThree1 The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, public static void main(String args]) remove all syntax and coding errors, and double myCheck50. 90 double yourCheck19. 95 System. Out. Println("Tips are") calcTip(nyCheck); calctip(yourcheck); run the program to ensure it works properly 7 GRADING Write your Java code in the coding area on the right. Use the Run Code button to execute and run the code and the Test button to run a series of pre-configured tests against your project. 10 public void calcTip (double bill) 12 13 14 15 16 17 18 19 20 final double RATE = θ. 15; double tip; tip checkRATE; System. Out. Println("The tip should be at Least "tip); Once you are happy with the test results, click Grade to submit your project for grading
Perhaps you meant to say that the applet should be displayed after the user hits the button. The answer in this situation might be to include your in a with a css-property of visibility:hidden;.
then develop an HTML button element that interacts with the element and modifies its visible property. When you press F5, the will automatically locate the project's entry point and begin . Additionally, you may launch a session from VS Code's Run and De view in the sidebar. further information. The Java Writer Class's write(String) function is used to write the given String to the stream. The argument is this String value.
Learn more about string here-
https://brainly.com/question/14528583
#SPJ4
Prompt
Explain three strategies you can use to take better notes.
Answer:
1. Use phrases not full sentences
2. Put your notes in categories
3. Take notes in your own words
Explanation:
It's right
1 Join Queries Assessment This database contains data about crimes repoted in the city of Chicago during 2018 1.1 Make a community-area neighborhood list. a. Show the side, community area name, and the name of the neighborhood. b. Sort the results by side then by community area name then by neighborhood
neighborhood on community area.area number = neighborhoo d.area number, then choose side, community area na, neighborhood from the community area inner join neighborhood Queries.
What kind of evaluation test would that be?types of assessment tests For instance, an IQ test is almost never omitted, and assessments frequently include personality and career tests as well. Next come the aptitude tests. Instead than focusing on traits like your personality or IQ, these tests are more concerned with your talents.
What is a SQL evaluation?In order to extract, combine, and alter data, the CRUD operations must be written for the live coding assignments used in the SQL online test to evaluate SQL skills. This test supports SQL queries in MySQL, MS SQL, and SQLite databases.
To know more about Queries visits :-
https://brainly.com/question/29304912
#SPJ4
5.2.8 Prevent Zone Transfers
The CorpDC3 server is a domain controller in the CorpNet.com domain. The server holds an Active Directory-integrated zone for the CorpNet.com domain.
You need to secure zone data and prevent anyone from copying zone data from the CorpDC3 server through zone transfer. Because all zone information is replicated automatically through Active Directory replication, you know you can disable zone transfers while still replicating data with other domain controllers.
In this lab, your task is to disable zone transfers for the CorpNet.com zone.
For the CorpNet.com zone, prevent zone transfers.
You must stop zone transfers for the CorpNet. com zone in this lab.
Finish the lab in the following way:
1. Click Tools > DNS from the Server Manager menu.
2. Expand Forward Lookup Zones in CORPDC3.
3. Click the Properties option when right-click the zone you wish to change.
4. Click the Tab for Zone Transfers.
5. Uncheck the box for Zone transfers.
6. Press OK.
The act of moving the contents of a zone file on a primary DNS server to a secondary DNS server is known as zone transfer. By syncing the zone files on a primary DNS server and a secondary DNS server, zone transfer offers fault tolerance.
Learn more about zone transfer:
https://brainly.com/question/14869816
#SPJ4
Exercise 7.2.7: ArrayList of Even Numbers 6 points Create an ArrayList of only even numbers from 2-100. Hint: Use a loop! 7.2.7: ArrayList of Even Numbers import java.util.ArrayList; public class Evens { public static void main(String[] args) { printArray(evens); } 1 2 3 4. 5 6 7 8 9 10 11 12 13 14 15 - 16 17 18 - 19 20 21 22 23 //Don't alter this method! It will print your array in the console public static void printArray(ArrayList array) { System.out.println("Array:"); for(int name: array) { System.out.print(name } } + "); }
The ArrayList of Even Numbers code is 6 points. Here is how to make an array list from 2 to 100 that only contains even numbers:
import java.util.ArrayList;
public class Evens {
public static void main(String[] args) {
ArrayList<Integer> evens = new ArrayList<>();
for (int i = 2; i <= 100; i += 2) {
evens.add(i); }
printArray(evens); }
public static void printArray(ArrayList<Integer> array) { System.out.println("Array:");
for (int name: array) {
System.out.print(name + " "); } } }
Sun Microsystems initially introduced Java, a programming language and computer platform, in 1995. It has grown from its modest origins to power a significant portion of the digital world of today by offering the solid foundation upon which numerous services and applications are developed. Java is still used in cutting-edge goods and digital services that are being developed for the future.
Although the majority of contemporary Java programmes mix the Java runtime and application,
Learn more about Arraylist here:
https://brainly.com/question/17265929
#SPJ4
Binary Trees Lab 20 Questions
Submission
o Submit all code and other materials in a single zip file to the appropriate assignment folder on Kodiak.
Goal: Build a system that learns to play a "20 Questions"-like game.
Files
• tree.py - (Do not modify.) Base class for all trees. . binary_tree.py - (Do not modify.) Base class for all binary trees. • linked_binary_tree.py - (Do not modify.) Implementation of a binary tree using linked nodes. • main.py - (Do not modify) Calls play_game() in twenty.py to play the game. • twenty.py - (Modify) Implements the 20 questions game. • training.txt - (Modify) A trace of you training your system. gametree.dat - (Modify) The saved tree generated by your training. Introduction Prior to doing any design, make sure to thoroughly review each of the modules which were distributed with this lab. If anything is unclear about these dasses, ask! Your textbook describes these classes in further detail in Sections 8.1-8.3. Problem You may have seen online games that purport to be "psychic," with the ability to correctly guess any item or character that you may be thinking of by asking yes/no questions of the player. Your goal is to write a program that can play this game, in part by learning about a universe of your choice as it plays by asking yes/no questions. For example, your program might learn about animals by having the following dialogue with its user. (For readability, user responses are shown here in red. The responses also use capital letters, which is not a requirement for this assignment.) Think of an animal, and I will guess it. Does it have legs? yes Is it a cat? yes I win! Continue? yes Think of an animal, and I will guess it. Does it have legs? no Is it a snake? yes I win! Continue? yes Think of an animal, and I will guess it. Does it have legs? no Is it a snake? no I give up. What is it? earthworm Please type a question whose answer is yes for earthworm and no for enake: Does it live underground? Continue? yes Think of an animal, and I will guess it. Does it have legs? no Does it live underground? no Is it a snake? no I give up. What is it? fish Please type a question whose answer is yes for fish and no for snake: Does it live in water? Continue? no The program begins with minimal knowledge about animals: It knows that cats have legs and snakes do not. When the program incorrectly guesses "snake" the next time, it asks for the answer and also asks for a way to distinguish between snakes and earthworms. The program builds a binary tree of questions and animals. A "yes" response to a question is stored in the question's left child; a "no" response to a question is stored in the question's right child Task Extend make a child class of) the Linkedinaryfree class to create a data structure that supports this game. Make use of the protected methods in LinkedBinaryTree to modify the tree structure. You may name your class anything you wish, though your module must be named twenty.py. Additionally, you must have a play_game () function in the module (not your class) that allows the user to play when it is called. We want to avoid having to retrain the system from scratch every time we play the game. So we'll save and load the tree to and from a file. BinaryTree (which you are extending) already has methods for saving and loading the tree: save_tree() and load_tree(). The examples below demonstrate how to use them. Save a tree to gametree.dat mytree.save_tres('gametree.dat') Load a tree from gametree.dat mytree = BinaryTree.load_tree 'gametree.dat's These methods read and write binary files. So you will not be able to read them in a plain text editor When the game first begins, ask if they want to load a file, and if so ask for the filename. Would you like to load a game? yes What file should I load? gametree.dat When the game ends, ask if the user would like to save the file, and if so ask for the filename to save the tree to. Would you like to save the game? yes What Eile should I save to (I will overwrite it)? gametree. dat import linked_binary_tree # Define your class here. Give it a better name than A, # and make sure it extends LinkedBinary Tree. class A: def play_game): # Game logic here. # Feel free to create other methods, modules and classes. | Provide a session log of you training your system from scratch. Just copy and paste your interaction with your program.
The binary tree is implemented using the following class to represent nodes in the tree. Please read the comment to learn how it is used.
/**
* A class to represent nodes in the binary tree that
* holds the questions. There are actually two types
* of nodes, depending on the value of the finalAnswer
* field.
*
* If finalAnswer is true, then the node represents a guess
* by the computer, and the question field should contain only
* the name of the item that is being guessed, such as "a dog"
* or "a tube worm". In this case, the node is a leaf, and the
* yes and no fields are ignored.
*
* If finalAnswer is false, then the node represents a
* question that the computer will ask. The question field
* contains the complete question, such as "Is it a mammal?"
* or "Are you thinking of a mammal?". The yes and no fields
* point to the subtrees that correspond to the answers "yes"
* and "no" to the question.
*/
private static class TreeNode {
boolean finalAnswer;
String question;
TreeNode yes;
TreeNode no;
}
Note that this class uses yes and no as pointers to the left and right subtrees. Also, note that only nodes in which finalAnswer is false have subtrees; nodes in which finalAnswer is true are leaves on the tree.
To learn more about TREE NODES please click on below link.
https://brainly.com/question/30224516
#SPJ4
which level of the osi model does a layer 2 switch operate at?
Answer:
data link layer
Explanation: