write a java program that will compute the number of page faults produced by a reference string using the opt, fifo, lru and clock replacement algorithms. the first command line argument will be the name of the file with the reference string and the second command line argument will be the number of page frames. your program should output to the console a chart showing each replacement strategy along with the number of page faults produced by the reference string. note: the first value in the input file will be the length of the reference string. design note: you need to have at least one class that encapsulates your page frames

Answers

Answer 1

Java program that computes the number of page faults using the OPT, FIFO, LRU and Clock replacement algorithms based on the provided reference string and the number of page frames.

import java.io.BufferedReader;

import java.io.FileReader;

import java.io.IOException;

import java.util.*;

class PageFrames {

   private int[] frames;

   private int currentIndex;

   public PageFrames(int numFrames) {

       frames = new int[numFrames];

       Arrays.fill(frames, -1);

       currentIndex = 0;

   }

   public boolean contains(int page) {

       for (int frame : frames) {

           if (frame == page) {

               return true;

           }

       }

       return false;

   }

   public void replace(int page) {

       frames[currentIndex] = page;

       currentIndex = (currentIndex + 1) % frames.length;

   }

   public void displayFrames() {

       for (int frame : frames) {

           System.out.print(frame + " ");

       }

       System.out.println();

   }

}

public class PageFaultCounter {

   public static void main(String[] args) {

       if (args.length < 2) {

           System.out.println("Usage: java PageFaultCounter <filename> <numFrames>");

           return;

       }

       String filename = args[0];

       int numFrames = Integer.parseInt(args[1]);

       int[] referenceString = readReferenceString(filename);

       System.out.println("Reference String: " + Arrays.toString(referenceString));

       System.out.println("Number of Frames: " + numFrames);

       System.out.println();

       PageFrames fifoFrames = new PageFrames(numFrames);

       PageFrames lruFrames = new PageFrames(numFrames);

       PageFrames clockFrames = new PageFrames(numFrames);

       int optPageFaults = countOptPageFaults(referenceString, numFrames);

       int fifoPageFaults = countFifoPageFaults(referenceString, fifoFrames);

       int lruPageFaults = countLruPageFaults(referenceString, lruFrames);

       int clockPageFaults = countClockPageFaults(referenceString, clockFrames);

       System.out.println("Replacement Strategy\tPage Faults");

       System.out.println("------------------------------------");

       System.out.println("OPT\t\t\t\t" + optPageFaults);

       System.out.println("FIFO\t\t\t" + fifoPageFaults);

       System.out.println("LRU\t\t\t\t" + lruPageFaults);

       System.out.println("Clock\t\t\t" + clockPageFaults);

   }

   private static int[] readReferenceString(String filename) {

       try (BufferedReader reader = new BufferedReader(new FileReader(filename))) {

           String line = reader.readLine();

           int length = Integer.parseInt(line);

           int[] referenceString = new int[length];

           line = reader.readLine();

           String[] tokens = line.split(" ");

           for (int i = 0; i < length; i++) {

               referenceString[i] = Integer.parseInt(tokens[i]);

           }

           return referenceString;

       } catch (IOException e) {

           System.out.println("Error reading reference string file: " + e.getMessage());

       }

       return new int[0];

   }

   private static int countOptPageFaults(int[] referenceString, int numFrames) {

       Set<Integer> frames = new HashSet<>();

       int pageFaults = 0;

       for (int i = 0; i < referenceString.length; i++) {

           int page = referenceString[i];

           if (!frames.contains(page)) {

               if (frames.size() < numFrames) {

                   frames.add(page);

               } else {

                   int farthestIndex = findFar

For similar questions on Java program

https://brainly.com/question/26789430

#SPJ11


Related Questions

preconfigured, predetermined attack patterns are called signatures. _________________________

Answers

Preconfigured attack patterns are known as signatures and are used to identify and block known malicious activity. While they are essential for protecting against known attacks, they should be used in conjunction with other security solutions to provide a comprehensive defense against cyber threats.

Preconfigured attack patterns are commonly used by cyber attackers to gain unauthorized access to networks, steal sensitive information, and compromise systems. These attack patterns are typically referred to as signatures, as they are pre-designed and can be easily recognized by security software. Signatures are created by security researchers and are used to identify and block known malicious activity.
Signatures are essential for protecting networks against known attacks, as they allow security software to quickly identify and respond to potential threats. However, signatures are not foolproof and can be bypassed by attackers who use new and unknown methods to breach security defenses.
To combat this, organizations need to implement multiple layers of security and use a combination of signature-based and behavior-based security solutions. By doing so, they can reduce the risk of attacks and protect their data and systems from both known and unknown threats.
In summary, preconfigured attack patterns are known as signatures and are used to identify and block known malicious activity. While they are essential for protecting against known attacks, they should be used in conjunction with other security solutions to provide a comprehensive defense against cyber threats.

To know more about preconfigured visit :

https://brainly.com/question/14531956

#SPJ11

Write a program that will remove "May" from the list using .Pop and .Index methods.(5pts) GIVEN: lst=["January", "February", "March", "April", "May", "June"]

Answers

Answer:

This question is answered in Python

lst=["January", "February", "March", "April", "May", "June"]

index = lst.index('May')

lst.pop(index)

print(lst)

Explanation:

This initializes the list

lst=["January", "February", "March", "April", "May", "June"]

This gets the index of May

index = lst.index('May')

This removes "May" from the list using pop()

lst.pop(index)

This prints the updated list

print(lst)


List three ways python can handle colors

Answers

Hi, your question is quite unclear. However, I inferred you want to know the colors that can be displayed on the Python module.

Answer:

redgreenblue, etc

Explanation:

Python, put simply, refers to a computer programming language; used to give the computer instructions.

The Python module can handle or display several different colors, some of which includes:

redgreenbluegreenpurple,cyan, etc.

When this logic block is included in a control structure, what must be the
case for the entire condition to be met?
and
OA. One or both of the conditions must be true.
OB. Only one of the conditions must be true.
C. Both conditions must be true.
OD. Neither condition must be true.
CUR

Answers

When this logic block is included in a control structure, for the entire condition to be met, " One or both of the conditions must be true." (Option A)

What is a Control Structure?

The sequence in which individual statements, instructions, or function calls in an imperative program are performed or evaluated is referred to as control flow in computer science. An imperative programming language is distinguished from a descriptive programming language by its emphasis on explicit control flow.

In structured programming, there are three basic control structures. Structure of Sequence Control: This refers to line-by-line execution, in which statements are run in the same sequence as they occur in the script.

In C, there are four types of control statements:

Statements of decision-making (if, if-else)Statements of choice (switch-case)Statements of iteration (for, while, do-while)jump  Statements (break, continue, goto)

In other words, control statements allow users to determine the sequence in which instructions in a program are executed. These enable the computer to make certain decisions, do particular activities repeatedly, or even go from one piece of code to another.

Learn more about Control Structure:
https://brainly.com/question/28144773
#SPJ1

Answer:

I think your asking the and one

the answer to that is

both conditions must be true

i just did it

Explanation:

what does prevent this page from creating additional dialogs mean

Answers

The “prevent this page from creating additional dialogs” is a JavaScript alert or prompt message that shows up on a page. It means that the page has already shown one alert or prompt message and will not show any more. This message prevents the page from creating additional dialog boxes and displays it in the case of multiple alert boxes that might pop up.

The alert() and prompt() methods in JavaScript are used to create dialog boxes that provide information to users or ask for their input. These dialog boxes can be created multiple times, but this can be annoying and disruptive for users if they keep appearing repeatedly. Therefore, this message is used to prevent this from happening and is displayed as a way to inform users that they will not see any more dialog boxes on the page.

This message is displayed as a result of a user action on a page such as a click or a button press, and it is triggered by JavaScript code that checks if a dialog box has already been displayed. If so, it displays this message instead of another dialog box. This helps to improve the user experience by reducing interruptions and distractions that can be caused by multiple dialog boxes.

To know more about JavaScript  visit:

https://brainly.com/question/16698901

#SPJ11

explain the evolutings of the computer describings the technolige used in different generations.

Answers

Answer:

Explanation:

Evolution of computer technology can be divided into five generations. First generation computer consisted of vacuum tubes and they were used from 1943-1958. Third generation (1966-1973) computer consisted of integrated circuits (IC) i.e. many transistors in single silicon chip.

to track and collect alerts generated by a network monitoring system and pass them to a central server, where they can be automatically picked up, evaluated, and, when appropriate, logged as an incident, a system would be best.

Answers

All occurrences are recorded, all recordings are kept forever, and there is endless time and money to go over all the recorded data in digital investigative heaven.

Commercially available log gathering, analysis, and reporting systems are available. In addition to options for storing logs, log management systems include a configuration interface that enables administrators to set log retention parameters for each specific data source. The essential nonrepudiation capabilities, such as "signing" logs with a calculated hash that can be afterwards compared to the files as a checksum, are also provided by log management systems at the time of collection. After being gathered, the logs can also be searched, analyzed, and produced prefiltered reports that display log data pertinent to a certain function or purpose.

Learn more about Management here-

https://brainly.com/question/14523862

#SPJ4

What is key to implementing a consistent Internet of Things (IoT) device, connectivity, and communications environment

Answers

It should be noted that the Key to implementing a consistent IoT device, connectivity, & communications environment is Interoperability standards.

When Interoperability standards is lacking,  application service providers, IoT device manufacturer can get weary in implemention of IoT devices.

What is Interoperability standards?

Interoperability standards serves as the operational processes that give room for underlying exchange as well as sharing of information in the system.

Learn more about Interoperability standards at:

https://brainly.com/question/5660386

Software that enables information to be obtained from a computer without the user's knowledge is ____________

Answers

Answer:

Spyware

Explanation:

When you focus on a target audience you are excluding possible groups from buying your product.

100 POINTSSS

Answers

If a person  focus on a target audience you are excluding possible groups from buying your product is a false statement.

Why you need to identify your target audience in the first place?

A person that is into business, may need to develop a tone of voice that truly resonates to your customer by defining your target audience.

A target audience research essentially provides you with direction for your marketing and assures better consistency in your messaging, and thus allowing you to forge stronger connections with customers.

Saying that If a person focus on a target audience you are excluding possible groups from buying your product is a false statement because it means that one is just trying to capture the heart of a certain group as well as not excluding the rest.

Hence, one can say the above statement is incorrect.

Learn more about target audience from

https://brainly.com/question/20812603
#SPJ1

When you focus on a target audience you are excluding possible groups from buying your product. True or  false

Does anybody play nba2k21 On ps4

Answers

Answer:

yeah but I gotta re-download it

Answer:

Nope but can i get it on switch

Explanation:

Cul es la función principal de word

Answers

Answer: Una palabra se usa para muchas cosas. ¡Se puede usar para hablar, describir algo o escribir así! ¡Avíseme si tiene más preguntas y haré todo lo posible para responderlas!

Explanation:

convert thefollowing decimal number to its equivalent binary, octal, hexadecimal 255

Answers

Answer:

Binary: 11111111

Octal: 377

Hexadecimal: FF

Explanation:

Given

Decimal Number: 255

Required

Convert to

- Binary

- Octal

- Hexadecimal

Converting to binary...

To convert to binary, we take note of the remainder when the quotient is divided by 2 until the quotient becomes 0;

255/2 = 127 R 1

127/2 = 63 R 1

63/2 = 31 R 1

31/2 = 15 R 1

15/2 = 7 R 1

7/2 = 3 R 1

3/2 = 1 R 1

1/2 = 0 R 1

By writing the remainder from bottom to top, the binary equivalent is 11111111

Converting to octal...

To convert to octal, we take note of the remainder when the quotient is divided by 8 until the quotient becomes 0;

255/8 = 31 R 7

31/8 = 3 R 7

3/8 = 0 R 3

By writing the remainder from bottom to top, the octal equivalent is 377

Converting to hexadecimal...

To convert to hexadecimal, we take note of the remainder when the quotient is divided by 16 until the quotient becomes 0;

255/16 = 15 R 15

15/16 = 0 R 15

In hexadecimal, 15 is represented by F; So, the above division can be rewritten as

255/16 = 15 R F

15/16 = 0 R F

By writing the remainder from bottom to top, the hexadecimal equivalent is FF

in section 2 of this lab, you used robocopy in the script to copy files from one remote machine to another. robocopy was selected because it is native to windows and is a robust tool with a variety of switches for customizing the command line. use the internet to research an alternative to robocopy that could be used in the script. explain your choice.

Answers

Rsync is an effective alternative to robocopy for use in scripts due to its cross-platform compatibility, efficient file transfer capabilities, and secure options.

Rsync is a suitable alternative to robocopy because it provides a range of features, such as delta transfer algorithm, which only transfers the differences between source and destination files, thereby saving bandwidth and time. Additionally, Rsync supports copying of file permissions and attributes, as well as compressing data during the transfer process to reduce network usage. It can also be used with SSH for secure file transfers.

Rsync is a powerful tool for copying and synchronizing files, and it can work over a network connection. It offers a wide range of options for customizing the copy operation, such as skipping certain files or folders, and preserving file permissions and timestamps.

To know more about robocopy visit :-

https://brainly.com/question/15231158

#SPJ11

1) Think about your favorite website. Describe several of the graphical elements used in that website. What makes those elements particularly effective?

Answers

Some of the elements that makes my favorite website beautiful and effective with the aid of CSS and Javascript are:

consistency, colours, typography, imagery, simplicity,  functionality

What is CSS?

This refers to the term that means Cascading Style Sheets and is used to design a website and make it colorful, beautiful and attractive.

When designing a website, it is important to use Javascript to improve the security and functionality of the site.


Read more about CSS here:

https://brainly.com/question/28721884
#SPJ1

Place the steps for attaching a file to a message in order from top to bottom.

CORRECT ORDER IS
1. Look under the message tab
2. Click attach file
3. Locate and select a file
4. Click Insert

Computer App-office 2016

Answers

Hey there!

The correct steps are:

Look under the message tabClick Insert Locate and select a fileClick attach file

Hope it help you

Answer:

Answers in order;

Look under the Message tab

Click attach file

locate and select file

click insert

Explanation:

what type of programming is commonly found in airplane and spacecraft control systems?

Answers

Airplane and spacecraft control systems commonly use embedded programming or embedded systems programming.

What is embedded programming?

Embedded programming involves developing software specifically designed to control  and manage the operations of embedded systems, which are  computer systems embedded within other devices or machinery.

In the case of airplane and spacecraft control systems, embedded programming is  used to write code that controls the various functions and operations of the aircraft or spacecraft, including navigation, flight controls, communication systems, data processing  and monitoring of critical parameters.

Learn more about programming at

https://brainly.com/question/16936315

#SPJ4

a) Explain in your own words the meaning of "systematic risk" and "unsystematic risk"? Provide an example of each type of risk. (2/3 lines) b) Why is there is less unsystematic risk in a portfolio wit

Answers

Systematic risk is the risk that cannot be diversified and is inherent to the overall market or the whole economy. A well-diversified portfolio will have more systematic risk than unsystematic risk, which means it is more affected by overall market conditions than by company-specific events.

For example, an increase in inflation or a global financial crisis will affect all stocks in the market. Unsystematic risk, on the other hand, is the risk that can be diversified and is inherent to a particular company or industry. This type of risk is not related to the market but is company-specific. For example, a company that relies heavily on a single product or a specific market is exposed to unsystematic risk.
b) There is less unsystematic risk in a portfolio with a larger number of stocks because unsystematic risk can be diversified through portfolio diversification. By holding a diversified portfolio that includes a large number of stocks from different industries, sectors, and markets, investors can reduce unsystematic risk. Diversification can reduce the impact of unsystematic risk on a portfolio because it allows for the offset of losses in one investment with gains in another. As the number of stocks in a portfolio increases, the impact of unsystematic risk decreases and the portfolio becomes more efficient. A well-diversified portfolio will have more systematic risk than unsystematic risk, which means it is more affected by overall market conditions than by company-specific events.

To know more about unsystematic risk visit :

https://brainly.com/question/29343207

#SPJ11

What traffic would an implicit deny firewall rule block?

Answers

Everything not allowed  traffic would an implicit deny firewall rule block.

What traffic would an implicit deny firewall rule block?

A firewall can help protect your computer and data by managing your network traffic. It does this by blocking unsolicited and unwanted incoming network traffic. A firewall validates access by assessing this incoming traffic for anything malicious like hackers and malware that could infect your computer.

Firewall rules can take the following actions: Allow Explicitly allows traffic that matches the rule to pass, and then implicitly denies everything else. Bypass: Allows traffic to bypass both firewall and intrusion prevention analysis.

By default, the firewall prevents all traffic from a lower security zone to a higher security zone (commonly known as Inbound) and allows all traffic from a higher security zone to a lower security zone (commonly known as Outbound).

To learn more about firewall rule refers to:

https://brainly.com/question/29109824

#SPJ4

When an event occurs, the agent logs details regarding the event. what is this event called?
a. mib
b. get
c. trap
d. oid

Answers

If an event occurs, the agent logs details regarding the event. what is this event called GET.

The information in the agent log file is known to be the beginning of the log file, which is stated to show the agent's launch and handling of the services and configuration settings.

Keep in mind that the agent log also contains a history of the activities performed by the agent during runtime, along with any errors, and that it is utilised to investigate deployment issues.

As a result, if an event happens, the agent logs information about it. What is this GET event, exactly?

The agent monitoring services' startup and configuration settings are displayed at the log file's beginning. The sequence of agent runtime activity and any observed exceptions are also included in the agent log.

Learn more about agent logs:

https://brainly.com/question/28557574

#SPJ4

Which example best demonstrates an impact of computers on the economy?

A. Entertainment is delivered instantly to users via streaming video to
televisions and smartphones.
B. Smartphones and other smart devices have changed the way we
research topics for school assignments.
C. Over a million people in the United States are employed in online
sales and advertising.
D. Content you post online may be used against you, hurting your
chances of employment.

Answers

The example that best demonstrates an impact of computers on the economy is that option C. Over a million people in the United States are employed in online sales and advertising.

What are the economic impacts of computers ?

A lot of studies have found a link between the use of computer and economic growth.

The use of  computer have improved communication, as well as inclusion, economic activity and good productivity and as such, The example that best demonstrates an impact of computers on the economy is that option C. Over a million people in the United States are employed in online sales and advertising.

Learn more about computers  from

https://brainly.com/question/24540334

#SPJ1

Answer:

C. Over a million people in the United States are employed in online

sales and advertising.

Given an "out" string length 4, such as "<<>>", and a word, return a new string where the word is in the middle of the out string, e.g. "<>". Note: use str.substring(i, j) to extract the String starting at index i and going up to but not including index j.
makeOutWord("<<>>", "Yay") → "<>"
makeOutWord("<<>>", "WooHoo") → "<>"
makeOutWord("[[]]", "word") → "[[word]]"

Answers

Answer:

The following are the answer to this question.

Explanation:

In the given code, a "makeOutWord and word" is already used to hold some value. In this code, we define a string method "makeOutWord" that accepts two string variables "out and the word" in its parameter.

Inside the method, a return keyword is used that uses the string variable "out and the word" with the "substring" method, this method is used to returns a new string from an old string value, and it also uses the "word" string variable for the return value.  

please find the attached file for code:

Given an "out" string length 4, such as "&lt;&lt;&gt;&gt;", and a word, return a new string where the

Yael would like to pursue a career where she helps design office spaces that are comfortable and help workers avoid injuries. What should she study? plsss help me with this question.

A. ergonomics

B. semantics

C. botany

D. genomics

Answers

The option that that  Yael should study is A. Ergonomics.

What is the study about?

Ergonomics is the scientific study of designing products, systems, and environments to optimize human comfort and health, including the design of office spaces.

Therefore, Yael could study ergonomics to gain the skills and knowledge necessary to design office spaces that are safe, efficient, and comfortable for workers. An ergonomist might work with architects, interior designers, and other professionals to ensure that the design of an office space takes into account the needs of the workers who will be using it.

Learn more about injuries from

https://brainly.com/question/19573072

#SPJ1

Class Example {
public static void main(String[] args) {
// This is the code editor
System. Out. Println(". And this is the terminal");
}
}

Answers

The provided code snippet is a basic   Java class named "Example" with a main method.

How does it work?

Inside the main method,there is a comment indicating that it is the code editor.

The code then prints out a message "And this is the terminal" using the System.out.println() statement. This statement will display the message in the terminal when the code is executed.

A code snippet is a small portion   or fragment of source code that represents a specific functionality or task. It is typically used to demonstrate or illustrate a particular programming concept, technique, or solution.

Learn more about code snippet at:

https://brainly.com/question/30467825

#SPJ1

where can I go to follow other people on brainly? ​

Answers

Answer:

You have to send them a friend request. Click on their profile and that will take you to another link, with their info. Click add friend there.

Hope this helps.

Good Luck

What is the difference between organizing your data in a list and organizing it in a data extension?

Answers

The difference between organizing your data in a list and organizing it in a data extension is that in a list, you organize subscribers by name. In a data extension, you organize them by region.

What is Data extension?A data extension contains contact information. A data extension is just a table with fields for contact information.Data extensions can work independently or in conjunction with other data extensions.The data may be used for searches, information retrieval, and sending to a selection of subscribers.You have two options for importing data extensions: manually or automatically using Automation Studio or the Marketing Cloud API.Both Contact Builder and Email Studio allow the usage of data extensions, but Email Studio is the only place where sharing, permissions, and other features are available.

To learn more about data extension, refer to the following link:

https://brainly.com/question/28578338

#SPJ4

How to solve the problem with the expiration of the root password to VMware vCenter (VCSA 6.7 console) - tip

Answers

To solve the problem with the expiration of the root password on VMware vCenter (VCSA 6.7 console), Restart the VCSA appliance,Modify boot parameters,Resume the boot process,Remount the file system as read-only and Reboot the appliance.


1.) Restart the VCSA appliance: First, you need to reboot the VCSA 6.7 appliance. To do this, access the vCenter Server Appliance Management Interface (VAMI) by browsing to https://:5480, and then log in with your administrator credentials. Go to the "Summary" tab and click on "Reboot" under "Actions."
2.) Interrupt the GRUB boot loader: During the appliance boot process, you will see the GRUB boot loader screen. Press the "e" key to interrupt the boot loader and enter edit mode.
3.) Modify boot parameters: In the edit mode, look for the line that starts with "linux" or "linuxefi" (depending on your VCSA version). At the end of this line, add the following parameter: rw init=/bin/bash. This will allow you to boot the appliance with root access.
4.)Resume the boot process: Press the "F10" key or "Ctrl+x" to resume the boot process. The VCSA will now boot with root access and a command prompt.
5.) Reset the root password: At the command prompt, enter the following command to reset the root password: passwd. You will be prompted to enter a new password for the root user. Make sure to create a strong, unique password.
6.) Remount the file system as read-only: After setting the new root password, you need to remount the file system as read-only to prevent any data corruption. To do this, enter the following command: mount -o remount,ro /
7.) Reboot the appliance: Finally, reboot the VCSA appliance by entering the following command: reboot -f
After the reboot, you should be able to log in to the VCSA 6.7 console with your new root password. Make sure to keep track of your password securely to avoid future issues.

for more such question on parameter

https://brainly.com/question/29673432

#SPJ11

As the security administrator for your organization, you must be aware of all types of attacks that can occur and plan for them. Which type of attack uses more than one computer to attack the victim?

Answers

Answer:

The answer is "DDoS "

Explanation:

The distributed denial of service attack (DDoS) occurs whenever a directed program's wireless data or assets, generally one or even more application servers, were also swamped by various machines. This attack is always the consequence of many affected systems, that fill up the target network with traffic.

This attack is aimed to avoid legal customers of one's website from accessing it.  In being effective in a DDoS attack, further demands need to be sent to the hacker than even the victim's server could deal with.  One other way to successfully attack is to send fake requests from the attacker.

Does somebody know how to this. This is what I got so far
import java.io.*;
import java.util.Scanner;


public class Lab33bst
{

public static void main (String args[]) throws IOException
{



Scanner input = new Scanner(System.in);

System.out.print("Enter the degree of the polynomial --> ");
int degree = input.nextInt();
System.out.println();

PolyNode p = null;
PolyNode temp = null;
PolyNode front = null;

System.out.print("Enter the coefficent x^" + degree + " if no term exist, enter 0 --> ");
int coefficent = input.nextInt();
front = new PolyNode(coefficent,degree,null);
temp = front;
int tempDegree = degree;
//System.out.println(front.getCoeff() + " " + front.getDegree());
for (int k = 1; k <= degree; k++)
{
tempDegree--;
System.out.print("Enter the coefficent x^" + tempDegree + " if no term exist, enter 0 --> ");
coefficent = input.nextInt();
p = new PolyNode(coefficent,tempDegree,null);
temp.setNext(p);
temp = p;
}
System.out.println();

p = front;
while (p != null)
{

System.out.println(p.getCoeff() + "^" + p.getDegree() + "+" );
p = p.getNext();


}
System.out.println();
}


}

class PolyNode
{

private int coeff; // coefficient of each term
private int degree; // degree of each term
private PolyNode next; // link to the next term node

public PolyNode (int c, int d, PolyNode initNext)
{
coeff = c;
degree = d;
next = initNext;
}

public int getCoeff()
{
return coeff;
}

public int getDegree()
{
return degree;
}

public PolyNode getNext()
{
return next;
}

public void setCoeff (int newCoeff)
{
coeff = newCoeff;
}

public void setDegree (int newDegree)
{
degree = newDegree;
}

public void setNext (PolyNode newNext)
{
next = newNext;
}

}



This is the instructions for the lab. Somebody please help. I need to complete this or I'm going fail the class please help me.
Write a program that will evaluate polynomial functions of the following type:

Y = a1Xn + a2Xn-1 + a3Xn-2 + . . . an-1X2 + anX1 + a0X0 where X, the coefficients ai, and n are to be given.

This program has to be written, such that each term of the polynomial is stored in a linked list node.
You are expected to create nodes for each polynomial term and store the term information. These nodes need to be linked to each previously created node. The result is that the linked list will access in a LIFO sequence. When you display the polynomial, it will be displayed in reverse order from the keyboard entry sequence.

Make the display follow mathematical conventions and do not display terms with zero coefficients, nor powers of 1 or 0. For example the polynomial Y = 1X^0 + 0X^1 + 0X^2 + 1X^3 is not concerned with normal mathematical appearance, don’t display it like that. It is shown again as it should appear. Y = 1 + X^3

Normal polynomials should work with real number coefficients. For the sake of this program, assume that you are strictly dealing with integers and that the result of the polynomial is an integer as well. You will be provided with a special PolyNode class. The PolyNode class is very similar to the ListNode class that you learned about in chapter 33 and in class. The ListNode class is more general and works with object data members. Such a class is very practical for many different situations. For this assignment, early in your linked list learning, a class has been created strictly for working with a linked list that will store the coefficient and the degree of each term in the polynomial.

class PolyNode
{
private int coeff; // coefficient of each term
private int degree; // degree of each term
private PolyNode next; // link to the next term node

public PolyNode (int c, int d, PolyNode initNext)
{
coeff = c;
degree = d;
next = initNext;
}

public int getCoeff()
{
return coeff;
}

public int getDegree()
{
return degree;
}

public PolyNode getNext()
{
return next;
}

public void setCoeff (int newCoeff)
{
coeff = newCoeff;
}

public void setDegree (int newDegree)
{
degree = newDegree;
}

public void setNext (PolyNode newNext)
{
next = newNext;
}
}

You are expected to add various methods that are not provided in the student version. The sample execution will indicate which methods you need to write. Everything could be finished in the main method of the program, but hopefully you realize by now that such an approach is rather poor program design.

Answers

I have a solution for you but Brainly doesn't let me paste code in here.

Write a program that takes three numbers as input from the user, and prints the largest.

Answers

Answer:

I'll be using python:

__________________________

a=int(input("Enter a number :"))

b=int(input("Enter another number :"))

c=int(input("Enter last number :"))

lis=[a,b,c]

sort=sorted(lis)

print("The largest number is:", sort[1])

___________________________

Other Questions
The following page is taken from which manuscript? A page from a 9th century Carolingian manuscript with rustic capitals. A. Book of Charlemagne b. Gospel of Ebbo c. Utrecht Psalter d. Book of Kells. When Jared walks into the restaurant up the street from his home,he notices stains on the carpet,wallpaper peeling off the walls,crumbs on the hostess stand,and several lights with burnt-out light bulbs.Overall this immediately gives Jared a negative Which figure is missing in the pattern?? If the retail price of a car is $12,099.00 and the percent of depreciation is 40% per year, what is the residual value of the car after one year? The continental __________ is the area of the ocean closest to the coastline. first grade. Which denotation of "revoke"has the best connotation forthe sentence below?The principal was willing tohis earlierdecision regarding herdiscipline.A. cancelB. retractC. erase Which equation shows the quadratic formula used correctly to solve 7x = 9+ x for x?-1 (1)-4(7) (9)2(7)OX=X=OX=Ox=1 (-1)-4(7)(9)2(7)-1 (-1) +4(7) (9)2(7)1 (-1) +4(7) (9)2(7) Alexander was offered a job that paid a salary of $34,000 in its first year. The salary was set to increase by 4% per year every year. If Alexander worked at the job for 5 years, what was the total amount of money earned over the 5 years, to the nearest whole number? A profit-maximizing price searcher will expand output as long as marginal revenue either exceeds or is equal to marginal cost, lowering its price or raising its price until the midpoint of their demand curve and highest total revenues are achieved.Why are oligopolies able to earn both short-run economic profits and long-run economic profits, while price taking firms like perfect competitors can only earn short-run economic profits?Review the characteristics of perfect competition and imperfect competition (monopolistic competition, oligopoly, and monopoly). Barriers to entry don't exist for perfect competition, but barriers to entry exist for imperfect competition. What are the implications of barriers to entry to the firm and competition? Review consumer surplus and producer surplus; what happens to consumer surplus is price is above equilibrium, or in this case above normal profits? Reflect on the concept of polynomial and rational functions. What concepts (only the names) did you need to accommodate these concepts in your mind? What are the simplest polynomial and rational function you can imagine? In your day to day, is there any occurring fact that can be interpreted as polynomial and rational functions? What strategy are you using to get the graph of polynomial and rational functions? Group assignment project oject you are (as a group) required to write a report that includes the following items n the course contents covered during the semester. Your project can be about one of ble areas listed below. reas: - Academic registration system - Bookstore system - Grocery store system - Restaurant system ms of the report: 1. Introduction 2. Problems and proposed solutions 3. Project planning 3.1 System Development Life Cycle (SDLC) 3.2 Gantt Chart 3.3 Workload Matrix 4. Feasibility Study 4.1 Operational Feasibility (PIECES Framework) 4.2 Technical Feasibility 4.3 Economic Feasibility 4.4 Schedule Feasibility 5. Requirements Determination 5.1 Interviews 5.2 Document Review 5.3 interviews 6. System Analysis 6. Design diagrams 6.1 ERD 6.2 Context diagram 6.3 Level-0 DFD Robots delivers goods in a factory. The sum of the maximum load of 3 robots (in kg) plus 120kg equals 220kg plus the max load of one robot.What is the maximum load of a robot plus 1000kg? A solution made by adding NaClO to enough water to make 2.00 L of solution has a pH of 10.50. Calculate the number of moles of NaClO that was added. Kb=3.3 x 10^-7 explain about bGeneral structural characteristics (nucleic acid and protein, enveloped and non-enveloped) is it necessary for a charged body to actually touch the ball of the electroscope for the leaves to diverge? Thanks to GAIA, the new diagrams created have helped scientists to learn to spot the difference in types of white dwarfs,discovering that some are dominated by which of two things?O carbon and nitrogenO hydrogen and heliumO beryllium and isotopesO helium and hydrogen Can someone please help me with question 5 and 6 Please if .163 moles of NaCI are dissolved in a 250 mL solution, what is the concentration of the NaCI solution? The value of an automobile company's stock fell 5 points over the last month.What integer represents the change in the stock's value? Which type is a metamorphic rock formed from shale?A.gneissB.limestoneC.sandstoneD.slate