1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zimovet [89]
2 years ago
15

Suppose that f() is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointe

r for a linked list. // Postcondition: The function f has done some computation with // the linked list, but the list itself is unchanged. What is the best data type for head_ptr in this function
Computers and Technology
1 answer:
kvv77 [185]2 years ago
5 0

Answer:

The best head_ptr in the linked list is the node. A device connected to a network is called the node.

For example, if there is a network of five computers and two printers, there are eight nodes. Each has a network address and uniquely identifies.

Explanation:

Suppose there is a link list of function struct like this

void f ( struct node * head)

There is a pointer and can change the structure. But cannot change the variable head points. So consider the following code

struct node

{

int f1

struct node* next:

}

If the head has pointed at the head of the link list, then it can use the struct node*.

You might be interested in
When you pass an array as an argument to a function, the function can modify the contents of the array?
taurus [48]
In most languages. Primitive data types ( char, int, float, bool, maybe string ) are usually passed by value, but compound data types are passed by reference, so you're not working on a copy but on the original.
8 0
2 years ago
for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1
ludmilkaskok [199]

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 String isbn;

 System.out.print("First 1:2 digits: ");

 isbn = input.nextLine();

 if(isbn.length()==12){

 int chksum = 0;

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

     if((i+1)%2==0){      chksum+= 3 * Character.getNumericValue(isbn.charAt(i));          }

     else{          chksum+=Character.getNumericValue(isbn.charAt(i));          }  }

 chksum%=10;

 chksum=10-chksum;

 if(chksum==10){

 System.out.print("The ISBN-13 number is "+isbn+"0");}

 else{

 System.out.print("The ISBN-13 number is "+isbn+""+chksum);          }   }

 else{

     System.out.print("Invalid Input");

 }     }}

Explanation:

See attachment for explanation where comments are used to explain each line

Download txt
6 0
3 years ago
2. In many jurisdictions a small deposit is added to containers to encourage people to recycle them. In one particular jurisdict
RUDIKE [14]

Answer:

Here is the Python program:

small_container = int(input("Enter the number of small containers you recycled?"))

large_container = int(input("Enter the number of large containers you recycled?"))

refund = (small_container * 0.10) + (large_container * 0.25)

print("The total refund for returning the containers is $" + "{0:.2f}".format(float(refund)))

Explanation:

The program first prompts the user to enter the number of small containers. The input value is stored in an integer type variable small_container. The input is basically an integer value.

The program then prompts the user to enter the number of large containers. The input value is stored in an integer type variable large_container. The input is basically an integer value.

refund = (small_container * 0.10) + (large_container * 0.25)  This statement computers the refund that will be recieved for returning the small and larger containers. The small containers holding one litre or less have a $0.10 deposit so the number of small containers is multiplied by 0.10. The large containers holding more than one litre have a $0.25 deposit so the number of large containers is multiplied by 0.25. Now both of these calculated deposits of containers of each side are added to return the refund that will be received for returning these containers. This whole computation is stored in refund variable.

print("The total refund for returning the containers is $" + "{0:.2f}".format(float(refund))) This print statement displays the refund in the format given in the question. The output includes a $ sign and displays exactly two decimal places by using {0:.2f} where .2f means 2 decimal places after the decimal point. Then the output is represented in floating point number using. format(float) is used to specify the output type as float to display a floating point refund value up to 2 decimal places.

5 0
3 years ago
Write a program that calculates payments for loan system. Implement for both client and Server. - The client sends loan informat
egoroff_w [7]

Answer:

Check the explanation

Explanation:

//Define the class.

public class Loan implements java.io.Serializable {

 

//Define the variables.

private static final long serialVersionUID = 1L;

private double annualInterestRate;

private int numberOfYears;

private double loanAmount;

private java.util.Date loanDate;

//Define the default constructor.

public Loan() {

this(2.5, 1, 1000);

}

//Define the multi argument constructor.

protected Loan(double annualInterestRate, int numberOfYears,

double loanAmount) {

this.annualInterestRate = annualInterestRate;

this.numberOfYears = numberOfYears;

this.loanAmount = loanAmount;

loanDate = new java.util.Date();

}

//Define the getter and setter method.

public double getAnnualInterestRate() {

return annualInterestRate;

}

public void setAnnualInterestRate(double annualInterestRate) {

this.annualInterestRate = annualInterestRate;

}

public int getNumberOfYears() {

return numberOfYears;

}

public void setNumberOfYears(int numberOfYears) {

this.numberOfYears = numberOfYears;

}

public double getLoanAmount() {

return loanAmount;

}

public void setLoanAmount(double loanAmount) {

this.loanAmount = loanAmount;

}

//Define the method to compute the monthly payment.

public double getMonthlyPayment() {

double monthlyInterestRate = annualInterestRate / 1200;

double monthlyPayment = loanAmount * monthlyInterestRate / (1 -

(Math.pow(1 / (1 + monthlyInterestRate), numberOfYears * 12)));

return monthlyPayment;  

}

//Define the method to get the total payment.

public double getTotalPayment() {

double totalPayment = getMonthlyPayment() * numberOfYears * 12;

return totalPayment;  

}

public java.util.Date getLoanDate() {

return loanDate;

}

}

//Define the client class.

public class ClientLoan extends Application {

 

//Create the server object.

ServerLoan serverLoan;

 

//Declare the variables.

int y;

double r, a, mp=0, tp=0;

String result,d1;

 

//Create the button.

Button b = new Button("Submit");

 

//Define the method stage.

public void start(Stage primaryStage) throws Exception {

 

TimeZone.setDefault(TimeZone.getTimeZone("EST"));

TimeZone.getDefault();

d1 = "Server Started at " +new Date();

 

//Create the GUI.

Label l1=new Label("Annual Interest Rate");

Label l2 = new Label("Number Of Years:");

Label l3 = new Label("Loan Amount");

TextField t1=new TextField();

TextField t2=new TextField();

TextField t3=new TextField();

TextArea ta = new TextArea();

 

//Add the components in the gridpane.

GridPane root = new GridPane();

root.addRow(0, l1, t1);

root.addRow(1, l2, t2, b);

root.addRow(5,l3, t3);

root.addRow(6, ta);

 

//Add gridpane and text area to vbox.

VBox vb = new VBox(root, ta);

 

//Add vbox to the scene.

Scene scene=new Scene(vb,400,250);

 

//Add button click event.

b.setOnAction(value -> {

 

//Get the user input from the text field.

r = Double.parseDouble(t1.getText());

y = Integer.parseInt(t2.getText());

a = Double.parseDouble(t3.getText());

 

//Create the loan class object.

Loan obj = new Loan(r, y, a);

 

//Call the method to compute the results.

mp = obj.getMonthlyPayment();

tp = obj.getTotalPayment();

 

//Format the results.

result = "Annual Interest Rate: "+ r+"\n"+

"Number of Years: "+y+"\n"+

"Loan Amount: "+a+"\n"+

"monthlyPayment: "+mp+"\n"+

"totalPayment: "+tp;

 

//Add the result to the textarea.

ta.setText(result);

 

//Create an object of the server class.

serverLoan = new ServerLoan(this);

});

 

//Set the scene to the stage.

//Set the stage title.

//Make the scene visible.

primaryStage.setScene(scene);

primaryStage.setTitle("ClientLoan");

primaryStage.show();

}

 

//Define the main method lauch the application.

public static void main(String args[])

{  

launch(args);

}

 

//Define the server class.

class ServerLoan extends Stage {

 

//Create the client loan object.

ClientLoan parent;

 

//Create the stage object.

Stage subStage;

 

//Create the text area.

TextArea ta = new TextArea();

 

//Define the constructor.

private ServerLoan(ClientLoan aThis) {

 

//Get the time in desired timezone.

TimeZone.setDefault(TimeZone.getTimeZone("EST"));

TimeZone.getDefault();

 

//Format the date with message.

String d2 = "Connected to client at " +new Date();

 

//Initialize the object.

parent = aThis;

 

//Add the date and the result to

//the text area.

ta.setText(d1);

ta.appendText("\n"+ d2);

ta.appendText("\n"+result);

 

//Create the grouppane.

GridPane root = new GridPane();

 

//Add text area to the group pane.

root.addRow(0, ta);

 

//Initialise the stage object.

subStage = new Stage();

 

//Add gridpane to the scene.

Scene scene = new Scene(root, 400, 200);

 

//Set the scene to the stage.

//Set the stage title.

//Make the scene visible.

subStage.setScene(scene);

subStage.setTitle("ServerLoan");

subStage.show();

}

}

}

Kindly check the Output in the attached image below.

4 0
3 years ago
Read 2 more answers
Information that indicates ground air or navy force levels or dispositions is what security?
AlexFokin [52]

Information that indicates ground air or navy force levels or dispositions is <u>confidential</u> security.

Security for a country's higher organizations is essential for a nation's protection.

Serious information like the nuclear organizations, army, navy, and ground air is at a higher risk for threats and hence requires higher security.

The information in such higher organizations is kept confidential and no third person is allowed access to the code of conduct of such organizations.

If information is leaked from the ground air or from navy force levels then there can be serious consequences for it. Hence, such information is always kept under confidential security.

To learn more about security, click here:

brainly.com/question/25375059

#SPJ4

8 0
1 year ago
Other questions:
  • What is intellectual property?
    13·1 answer
  • What is the correct process for inserting a blank worksheet in Google sheets
    12·1 answer
  • If it is impractical to place guest users in a secure network, isolated from the production network by firewall barriers, then:
    14·1 answer
  • Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG
    8·1 answer
  • Why Stockholder are interested in the way a company operate?
    12·1 answer
  • To enter new code that performs as intended in the place of the old code that produces an error is the goal of
    9·1 answer
  • A process at Host C receiving two incoming UDP segments from two different hosts will know that they originated from two differe
    14·2 answers
  • In C#Write the program SubscriptExceptionTest in which you use an array of 10 doubles. Write a try block in which you place a lo
    5·1 answer
  • Write 3 things that can't be done without technology.
    14·2 answers
  • 8.4 Lesson Practice <br> edhesive quiz
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!