Answer:
it would have to be flow control which would be C.
Explanation:
Flow Control is restricts the ability for individuals to reveal information present in some part of the database. Hence, option C is correct.
What is Flow Control?The management of data flow between computers, devices, or network nodes is known as flow control. This allows the data to be processed at an effective rate. Data overflow, which occurs when a device receives too much data before it can handle it, results in data loss or retransmission.
A design concern at the data link layer is flow control. It is a method that typically monitors the correct data flow from sender to recipient. It is very important because it allows the transmitter to convey data or information at a very quick rate, which allows the receiver to receive it and process it.
The amount of data transmitted to the receiver side without any acknowledgement is dealt with by flow control.
Thus, option C is correct.
For more information about Flow Control, click here:
https://brainly.com/question/28271160
#SPJ5
A process needs 103 KB of memory in order to run. If the system on which it is to run uses paging with 2 KB pages, how many frames in memory are needed
Answer: 52
Explanation:
Following the information given in the question, we are informed that a process needs 103 KB of memory in order to run and that the system on which it is to run uses paging with 2KB pages, then the number of frames in memory that are needed will be:
= 103/2
= 51.5
= 52 approximately
Therefore, 52 frames in memory are needed.
Web-Based Game that serves multiple platforms
Recommendations
Analyze the characteristics of and techniques specific to various systems architectures and make a recommendation to The Gaming Room. Specifically, address the following:
1. Operating Platform: Recommend an appropriate operating platform that will allow The Gaming Room to expand Draw It or Lose It to other computing environments.>
2. Operating Systems Architectures:
3. Storage Management:
4. Memory Management:
5. Distributed Systems and Networks:
6. Security: Security is a must-have for the client. Explain how to protect user information on and between various platforms. Consider the user protection and security capabilities of the recommended operating platform.>
Answer:
Here the answer is given as follows,
Explanation:
Operating Platform:-
In terms of platforms, there are differences between, mobile games and pc games within the way it's used, the operator, the most event play, the sport design, and even the way the sport work. we all know that each one the games on console platforms, PC and mobile, have their own characteristic which has advantages and disadvantages All platforms compete to win the rating for the sake of their platform continuity.
Operating system architectures:-
Arm: not powerful compared to x86 has many limitations maximum possibility on arm arch is mobile gaming.
X86: very powerful, huge development so easy to develop games on platforms like unity and unreal, huge hardware compatibility and support
Storage management:-
On the storage side, we've few choices where HDD is slow and too old even a replacement console using SSD. so SSD is the suggested choice. But wait SSD have also many options like SATA and nvme.
Memory management:-
As recommended windows, Each process on 32-bit Microsoft Windows has its own virtual address space that permits addressing up to 4 gigabytes of memory. Each process on 64-bit Windows features a virtual address space of 8 terabytes. All threads of a process can access its virtual address space. However, threads cannot access memory that belongs to a different process.
Distributed systems and networks:-
Network-based multi-user interaction systems like network games typically include a database shared among the players that are physically distributed and interact with each other over the network. Currently, network game developers need to implement the shared database and inter-player communications from scratch.
Security:-
As security side every game, there's an excellent risk that, within the heat of the instant, data are going to be transmitted that you simply better keep to yourself. There are many threats to your IT.
Define on the whole data protection matters when developing games software may cause significant competitive advantages. Data controllers are obliged under the GDPR to attenuate data collection and processing, using, as an example , anonymization or pseudonymization of private data where feasible.
Ms. Lawson, a primary school teacher, told her students that a photograph of the president is in the public domain. What does she mean by this?
Answer:
He belongs to the nation
Using the concepts of public and private domains, it means that the photograph of the president can be used by anyone without asking for permission.
---------------
Public and private domains:
If an image is of private domain, there is the need to ask the owner for the right to use the image.If it is of public domain, there is no need, as is the case for the president photo in this question.A similar question is given at https://brainly.com/question/12202794
Write a simple nested loop example that sums the even and odd numbers between 5 and 15 and prints out the computation.
Answer:
for e in range(6, 15, 2):
for o in range(5, 15, 2):
calc = e+o
print(e, "+", o, "=", calc)
Explanation:
g 1-1 Which network model layer provides information about the physical dimensions of a network connector like an RJ45
Answer:
Physical layer
Explanation:
OSI model stands for Open Systems Interconnection. The seven layers of OSI model architecture starts from the Hardware Layers (Layers in Hardware Systems) to Software Layers (Layers in Software Systems) and includes the following;
1. Physical Layer
2. Data link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
Each layer has its unique functionality which is responsible for the proper functioning of the communication services.
In the OSI model, the physical layer is the first and lowest layer. Just like its name physical, it addresses and provides information about the physical characteristics such as type of connector, cable type, length of cable, etc., of a network.
This ultimately implies that, the physical layer of the network (OSI) model layer provides information about the physical dimensions of a network connector such as a RJ45. A RJ45 is used for connecting a CAT-5 or CAT-6 cable to a networking device.
When a database stores the majority of data in RAM rather than in hard disks, it is referred to as a(n) _____ database.
Answer:
in-memory.
Explanation:
A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to effectively and efficiently create, store, modify, retrieve, centralize and manage data or informations in a database. Thus, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.
Generally, a database management system (DBMS) acts as an intermediary between the physical data files stored on a computer system and any software application or program.
In this context, data management is a type of infrastructure service that avails businesses (companies) the ability to store and manage corporate data while providing capabilities for analyzing these data.
Hence, a database management system (DBMS) is a system that enables an organization or business firm to centralize data, manage the data efficiently while providing authorized users a significant level of access to the stored data.
Radom Access Memory (RAM) can be defined as the main memory of a computer system which allow users to store commands and data temporarily.
Generally, the Radom Access Memory (RAM) is a volatile memory and as such can only retain data temporarily.
All software applications temporarily stores and retrieves data from a Radom Access Memory (RAM) in computer, this is to ensure that informations are quickly accessible, therefore it supports read and write of files.
Generally, when a database stores the majority of data in random access memory (RAM) rather than in hard disks, it is referred to as an in-memory database (IMDB).
An in-memory database (IMDB) is designed to primarily to store data in the main memory of a computer system rather than on a hard-disk drive, so as to enhance a quicker response time for the database management system (DBMS).
If you fail a course as a MAIN (residency) course, you can repeat that course as either a MAIN (residency) or an online (IG or IIG) course. True False
Answer: False
Explanation:
The statement that "you fail a course as a MAIN (residency) course, you can repeat that course as either a MAIN (residency) or an online (IG or IIG) course" is false.
It should be noted that if one fail a course as a residency course, the course can only be repeated as a main (residency) course and not an online course. When a course is failed, such course has to be repeated the following semester and this will give the person the chance to improve their GPA.
The HEIGHT variable will be used to hold the index numbers of the rows in a multidimensional array. The WIDTH will be used to hold the index numbers of the columns. Which of the following completed for loop could fill that previously declared anArray multidimensional array with the value 0 in each position?(a) for (int n=0; n < HEIGHT; n++) { for (int m=0; m < WIDTH; m++) { int anArray[0][0]; }}(b) for (int n=0; n < HEIGHT; n++) { for (int m=0; m < WIDTH; m++) { } anArray[n][m] = 0; }(c) for (int n=0; n < WIDTH; n++) { for (int m=0; m < HEIGHT; m++) { int anArray[n][m] = { {0,0,0}{0,0,0}{0,0,0}{0,0,0|}{0,0,0}}; }}(d) for (int n=0; n < HEIGHT; n++) { for (int m=0; m < WIDTH; m++) { anArray[n][m] = 0; }}
Answer:
(d) for (int n=0; n < HEIGHT; n++) { for (int m=0; m < WIDTH; m++) { anArray[n][m] = 0; }}
Explanation:
Given
HEIGHT [tex]\to[/tex] rows
WIDTH [tex]\to[/tex] columns
Required
Fill the array with zeros
Assume the array has already been declared
First, we iterate through the rows; using:
for (int [tex]n=0[/tex]; [tex]n < HEIGHT[/tex]; [tex]n++[/tex]) {
Next, we iterate through the columns
for (int [tex]m=0[/tex]; [tex]m < WIDTH[/tex]; [tex]m++[/tex]) {
Then we fill the array with the iterating variables of rows and the columns
anArray[n][m]
Lastly, close the loops
}}
Question 1(Multiple Choice Worth 5 points)
(01.01 MC)
Which broad category is known for protecting sensitive information in both digital and hard-copy forms?
O Cybersecurity
O Information protection
O Information assurance
Internet Crime Complaint Center
Answer:
Information assurance
Explanation:
Data theft can be defined as a cyber attack which typically involves an unauthorized access to a user's data with the sole intention to use for fraudulent purposes or illegal operations. There are several methods used by cyber criminals or hackers to obtain user data and these includes DDOS attack, SQL injection, man in the middle, phishing, etc.
Information assurance is a broad category that is typically used by cybersecurity or network experts to protect sensitive user information such as passwords, keys, emails, etc., in both digital and hard-copy forms
In the file BankAccount.java, build a class called BankAccount that manages checking and savings accounts. The class has three private member fields: a customer name (String), the customer's savings account balance (double), and the customer's checking account balance (double).
Implement the following Constructor and instance methods as listed below:
public BankAccount(String newName, double amt1, double amt2) - set the customer name to parameter newName, set the checking account balance to parameter amt1 and set the savings account balance to parameter amt2. (amt stands for amount)
public void setName(String newName) - set the customer name
public String getName() - return the customer name
public void setChecking(double amt) - set the checking account balance to parameter amt
public double getChecking() - return the checking account balance
public void setSavings(double amt) - set the savings account balance to parameter amt
public double getSavings() - return the savings account balance
public void depositChecking(double amt) - add parameter amt to the checking account balance (only if positive)
public void depositSavings(double amt) - add parameter amt to the savings account balance (only if positive)
public void withdrawChecking(double amt) - subtract parameter amt from the checking account balance (only if positive)
public void withdrawSavings(double amt) - subtract parameter amt from the savings account balance (only if positive)
public void transferToSavings(double amt) - subtract parameter amt from the checking account balance and add to the savings account balance (only if positive)
Answer:
Explanation:
The following code is written in Java and creates the BankAccount class with all of the requested methods, including the constructor, getter and setter methods, withdraw methods, and even the transferToSavings method. A preview can be seen in the attached image below.
class BankAccount {
private String customerName;
private double savingsBalance, checkingsBalance;
public BankAccount(String newName, double amt1, double amt2) {
this.customerName = newName;
this.checkingsBalance = amt1;
this.savingsBalance = amt2;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public double getSavingsBalance() {
return savingsBalance;
}
public void setSavingsBalance(double savingsBalance) {
this.savingsBalance = savingsBalance;
}
public double getCheckingsBalance() {
return checkingsBalance;
}
public void setCheckingsBalance(double checkingsBalance) {
this.checkingsBalance = checkingsBalance;
}
public void depositChecking(double amt) {
if (amt > 0) {
this.checkingsBalance += amt;
}
}
public void depositSavings(double amt) {
if (amt > 0) {
this.savingsBalance += amt;
}
}
public void withdrawChecking(double amt) {
if (amt > 0) {
this.checkingsBalance -= amt;
}
}
public void withdrawSavings(double amt) {
if (amt > 0) {
this.savingsBalance -= amt;
}
}
public void transferToSavings(double amt) {
if (amt > 0 ) {
this.checkingsBalance -= amt;
this.savingsBalance += amt;
}
}
}
Answer:
public class BankAccount {
private String customerName;
private double savingsBalance;
private double checkingsBalance;
public BankAccount(String newName, double amt1, double amt2) {
this.customerName = newName;
this.checkingsBalance = amt1;
this.savingsBalance = amt2;
}
public void setName(String newName) {
this.customerName = customerName;
}
public String getName() {
return customerName;
}
public void setChecking(double checkingsBalance) {
this.checkingsBalance = checkingsBalance;
}
public double getChecking() {
return checkingsBalance;
}
public void setSavings(double savingsBalance) {
this.savingsBalance = savingsBalance;
}
public double getSavings() {
return savingsBalance;
}
public void depositChecking(double amt) {
if (amt > 0) {
this.checkingsBalance += amt;
}
}
public void depositSavings(double amt) {
if (amt > 0) {
this.savingsBalance += amt;
}
}
public void withdrawChecking(double amt) {
if (amt > 0) {
this.checkingsBalance -= amt;
}
}
public void withdrawSavings(double amt) {
if (amt > 0) {
this.savingsBalance -= amt;
}
}
public void transferToSavings(double amt) {
if (amt > 0 ) {
this.checkingsBalance -= amt;
this.savingsBalance += amt;
}
}
}
what is the answer to the question asked in the picture attached below
Answer:
option - b
Explanation:
i think this is the right answer..
If you are going to refer to a few dozen classes in your application, how do
you do it?
Answer:
Explanation:
use the "includes" statement to have access to those classes :)
A technician needs to manage a Linux-based system from the GUI remotely. Which of the technician should the technician deploy
Complete Question:
A technician needs to manage a Linux-based system from the GUI remotely. Which of the following technologies should the technician deploy?
A. RDP
B. SSH
C. VNC
D. Telnet
Answer:
Managing a Linux-based System from the GUI Remotely
The technology that the technician should deploy to manage the Graphic User Interface (GUI) remotely is:
C. VNC
Explanation:
VNC stands for Virtual Network Computing. This computing technology enables a remote user to access and control another computer to execute commands. It acts as a cross-platform screen-sharing system and is used to remotely access and control another computer. VNC makes a computer screen, keyboard, and mouse available to be seen and used from a remote distance. The remote user does everything from a secondary device without being in front of the primary computer or device. An example of a good VNC is TeamViewer.
what is a high level language?
Answer:
a high level language is any programming language that enables development of a program in a much more user friendly programming context and is generally independent of the computers hardware architecture.
Answer:
A high-level language is any programming language that enables development of a program in a much more user-friendly programming context and is generally independent of the computer's hardware architecture.
This standard library function returns a random floating-point number in the range of 0.0 up to 1.0 (but not including 1.0).
a. random.b. randint.c. random_integer.d. uniform.
Answer:
The answer would be A: Random
Explanation:
The random() function returns a generated random number (a pseudorandom number)
Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class ShoppingCart which supports the following functions: add_item(), get_total_price(), and print_summary(). Write code only where the three TODO's are. Below is the expected output: Added 2 Pizza(s) to Cart, at $13.12 each. Added 1 Soap(s) to Cart, at $2.25 each. Added 5 Cookie(s) to Cart, at $3.77 each.
Answer:
Explanation:
The following is written in Java. It creates the ShoppingCart class as requested and implements the requested methods. A test class has been added to the main method and the output is highlighted in red down below.
import java.util.ArrayList;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
ShoppingCart newCart = new ShoppingCart();
newCart.add_item();
newCart.add_item();
newCart.add_item();
newCart.print_summary();
}
}
class ShoppingCart {
Scanner in = new Scanner(System.in);
ArrayList<String> items = new ArrayList<>();
ArrayList<Integer> amount = new ArrayList<>();
ArrayList<Double> cost = new ArrayList<>();
public ShoppingCart() {
}
public void add_item() {
System.out.println("Enter Item:");
this.items.add(this.in.next());
System.out.println("Enter Item Amount:");
this.amount.add(this.in.nextInt());
System.out.println("Enter Cost Per Item:");
this.cost.add(this.in.nextDouble());
}
public void get_total_price() {
double total = 0;
for (double price: cost) {
total += price;
}
System.out.println("Total Cost: $" + total);
}
public void print_summary() {
for (int i = 0; i < items.size(); i++) {
System.out.println(amount.get(i) + " " + items.get(i) + " at " + cost.get(i) + " each.");
}
get_total_price();
}
}
Write a program named edit_data.py that asks a person their age. Accept an int. Use a custom exception to return a message if the number entered is an int that is less than 1 or greater than 115. Create an exception that catches an error if a non int is entered.
An error that occurs while a program is being run is an exception. Non-programmers see exceptions as examples that do not follow a general rule.
What is the programming?
In computer science, the term "exception" also has the following connotation: It signifies that the issue is an uncommon occurrence; it is the "exception to the rule." Some programming languages use the mechanism known as exception handling to deal with problems automatically. Exception handling is built into several programming languages, including C++, Objective-C, PHP, Java, Ruby, Python, and many others.
In order to manage errors, programs often save the state of execution at the time the problem occurred and interrupt their usual operation to run an exception handler, which is a particular function or section of code. Depending on the type of error that had occurred, the error handler can "correct" the issue and the application can then continue using the previously saved data.
Thus, An error that occurs while a program is being run is an exception.
For more information about programming, click here:
https://brainly.com/question/11023419
#SPJ5
Factors to consider when buying a computer
Answer:
money
Explanation:
for working for socializing with orher
What are the LinkedIn automation tools you are using?
Answer:
Well, for me I personally use LinkedCamap to drive more LinkedIn connections, hundreds of leads, sales, and conversions automatically.
Some other LinkedIn automation tools are;
ExpandiMeet AlfredPhantombusterWeConnectLinkedIn HelperHope this helps!
my mom hid my laptop and now I can't find it
Answer: did you look everywhere ask for it and be like mom i wont do (whatever you did) ever again so please give me a chance can i plsss!!!!!! have it back?
Explanation:
simple as that step by step
When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
Answer:
Parameter
Explanation:
q: When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
a: Parameter
Complete the calcAverage() method that has an integer array parameter and returns the average value of the elements in the array as a double.(Java program)
Ex: If the input array is:
1 2 3 4 5
then the returned average will be:
3.0
Answer:
Explanation:
The following Java program has the method calcAverage(). It creates a sum variable which holds the sum of all the values in the array and the count variable which holds the number of elements in the array. Then it uses a For Each loop to loop through the array and go adding each element to the sum variable. Finally it calculates the average by dividing the sum by the variable count and returns the average to the user. A test case has been created in the main method using the example in the question. The output can be seen in the image attached below.
class Brainly {
public static void main(String[] args) {
int[] myArr = {1, 2, 3, 4, 5};
System.out.println(calcAverage(myArr));
}
public static double calcAverage(int[] myArr) {
double sum = 0;
double count = myArr.length;
for (int x: myArr) {
sum += x;
}
double average = sum / count;
return average;
}
}
The manager of the Super Supermarket would like to be able to compute the unit price for products sold there. To do this, the program should input the name and price of an item per pound and its weight in pounds and ounces. Then it should determine and display the unit price (the price per ounce) of that item and the total cost of the amount purchased. You will need the following variables: ItemName Pounds Ounces PoundPrice TotalPrice UnitPriceYou will need the following formulas: UnitPrice = PoundPrice/16 TotalPrice = PoundPrice * (Pounds + Ounces/16)
Answer:
The program in Python is as follows:
name = input("Name of item: ")
PoundPrice = int(input("Pound Price: "))
Pounds = int(input("Weight (pounds): "))
Ounces = int(input("Weight (ounce): "))
UnitPrice = PoundPrice/16
TotalPrice = PoundPrice * (Pounds + Ounces/16)
print("Unit Price:",UnitPrice)
print("Total Price:",TotalPrice)
Explanation:
This gets the name of the item
name = input("Name of item: ")
This gets the pound price
PoundPrice = int(input("Pound Price: "))
This gets the weight in pounds
Pounds = int(input("Weight (pounds): "))
This gets the weight in ounces
Ounces = int(input("Weight (ounce): "))
This calculates the unit price
UnitPrice = PoundPrice/16
This calculates the total price
TotalPrice = PoundPrice * (Pounds + Ounces/16)
This prints the unit price
print("Unit Price:",UnitPrice)
This prints the total price
print("Total Price:",TotalPrice)
what is the meaning of compiler
Answer:
in computing it means a program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer.
A network has the ability to direct traffic toward all of the receiving service. what provides this ability in the transport layer?
Answer:
Multiplexing is the correct answer
Explanation:
End-to-end communication over a network is done by transport layer.
Provides a logical communication between various application processes running on different hosts and this layer is set in OSI(open system interconnection) model.
Transport layer also manages error and correction and also it provides reliability to users.
Multiplexing gets allowed by the transport layer which enables to transfer messages over a network and also the error and corrected data.
Write a program that reads a list of words. Then, the program outputs those words and their frequencies. Ex: If the input is: hey hi Mark hi mark
Answer:
The program in Python is as follows:
wordInput = input()
myList = wordInput.split(" ")
for i in myList:
print(i,myList.count(i))
Explanation:
This gets input for the word
wordInput = input()
This splits the word into a list using space as the delimiter
myList = wordInput.split(" ")
This iterates through the list
for i in myList:
Print each word and its count
print(i,myList.count(i))
Select the true statement about network protocols.
A. Communication cannot take place unless the protocol is executed in the same way on all devices.
B. One function of a protocol is to decompress data when it is delivered to the receiving computer.
C. Using a protocol other than TCP/IP can result in data loss.
D. Computers that are distributed across a large geographic area need a special protocol to resolve errors.
The statement that is true about network protocols is that:
Using a protocol other than TCP/IP can result in data loss.What are network protocols?A network protocol is a system of principles that governs how data is delivered between devices on the same network.
Primarily, it enables linked devices to interact with one another despite variations in internal operations, architecture, or design.
The way this is done is true the use of Transmission-control protocol/Internet protocol (TCP/IP).
TCP/IP is the primary protocol or communication language of the Internet. Therefore, using a protocol other than TCP/IP can result in data loss.
Learn more about network protocol here:
https://brainly.com/question/17820678
Please use thread to complete the following program: one process opens a file data.txt, then creates a thread my_thread. The job of the thread my_thread is to count how many lines exist in the file data.txt, and return the number of lines to the calling process. The process then prints this number to the screen.
Basically, you need to implement main_process.c and thread_function.c.
Basic structure of main_process.c:
int main ()
{
Open the file data.txt and obtain the file handler fh;
Create a thread my_thread using pthread_create; pass fh to my_thread;
Wait until my_thread terminates, using pthread_join;
Print out how many lines exist in data.txt.}
Basic structure of thread_function.c:
void *count_lines(void *arg)
{
Obtain fh from arg;
Count how many lines num_lines exist in fh;
Close fh;
Return num_lines
}
Answer:
Here is the code:-
//include the required header files
#include<stdio.h>
#include<pthread.h>
// method protocol definition
void *count_lines(void *arg);
int main()
{
// Create a thread handler
pthread_t my_thread;
// Create a file handler
FILE *fh;
// declare the variable
int *linecnt;
// open the data file
fh=fopen("data.txt","r");
// Create a thread using pthread_create; pass fh to my_thread;
pthread_create(&my_thread, NULL, count_lines, (void*)fh);
//Use pthread_join to terminate the thread my_thread
pthread_join( my_thread, (void**)&linecnt );
// print the number of lines
printf("\nNumber of lines in the given file: %d \n\n", linecnt);
return (0);
}
// Method to count the number of lines
void *count_lines(void *arg)
{
// variable declaration and initialization
int linecnt=-1;
char TTline[1600];
//code to count the number of lines
while(!feof(arg))
{
fgets(TTline,1600,arg);
linecnt++;
}
pthread_exit((void *)linecnt);
// close the file handler
fclose(arg);
}
Explanation:
Program:-
Compute change
A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of one dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator.
import java.util.Scanner;
public class ComputingChange {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int amountToChange;
int numFives;
int numOnes;
amountToChange = scnr.nextInt();
numFives = amountToChange / 5;
/* Your solution goes here */
System.out.print("numFives: ");
System.out.println(numFives);
System.out.print("numOnes: ");
System.out.println(numOnes);
}
}
Answer:
Explanation:
The following code is written in Java and modified to do as requested. It asks the user to enter a number that is saved to the amountToChange and then uses the % operator to calculate the number of 5 dollar bills and the number of 1 dollar bills to give back. A test case has been provided and the output can be seen in the attached image below.
import java.util.Scanner;
class ComputingChange {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int amountToChange;
int numFives;
int numOnes;
amountToChange = scnr.nextInt();
numFives = amountToChange / 5;
/* Your solution goes here */
numOnes = amountToChange % 5;
System.out.print("numFives: ");
System.out.println(numFives);
System.out.print("numOnes: ");
System.out.println(numOnes);
}
}
Suppose that you write a subclass of Insect named Ant. You add a new method named doSomething to the Ant class. You write a client class that instantiates an Ant object and invokes the doSomething method. Which of the following Ant declarations willnot permit this? (2 points)I. Insect a = new Ant ();II. Ant a = new Ant ();III. Ant a = new Insect ();1) I only2) II only3) III only4) I and II only5) I and III only
Answer:
5) I and III only
Explanation:
From the declarations listed both declarations I and III will not permit calling the doSomething() method. This is because in declaration I you are creating a superclass variable but initializing the subclass. In declaration III you are doing the opposite, which would work in Java but only if you cast the subclass to the superclass that you are initializing the variable with. Therefore, in these options the only viable one that will work without error will be II.