The following numbers are inserted into a linked list in this order:
10, 20, 30, 40, 50, 60
What would the following statements display?
pCur = head->next;
cout << pCur->data << " ";
cout << pCur->next->data << endl;
a) 20 30
b) 40 50
c) 10 20
d) 30 40

Answers

Answer 1

Answer:

A. 20 30

Explanation:

Given

Linked list: 10, 20, 30, 40, 50, 60

Required

The output of the following code segment

pCur = head->next;

cout << pCur->data << " ";

cout << pCur->next->data << endl;

A linked list operates by the use of nodes which begins from the head to the next node, to the next, till it reaches the last;

The first line of the code segment; "pCur = head->next; " shifts the node from the head to the next node

The head node is the node at index 0 and that is 10;

This means that the focus has been shifted to the next at index 1 and that is 20;

So, pCur = 20

The next line of the code segment; cout << pCur->data << " "; prints pCur and a blank space

i.e. "20 " [Take note of the blank space after 20]

The last line "cout << pCur->next->data << endl; " contains two instructions which are

1. pCur = next->data;

2. cout<<pCur->data;

(1) shifts focus to the next node after 20 ; This gives pCur = 30

(2) prints the value of pCur

Hence, the output of the code segment is 20 30


Related Questions

In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Hill cipher where the Hill matrix can be any size from 2 x 2 up to 9 x 9. The program can be written using one of the following: C, C++, or Java. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below.Command Line Parameters1. Your program compile and run from the command line.2. The program executable must be named "hillcipher" (all lowercase, no spaces or file extension).3. Input the required file names as command line parameters. Your program may NOT prompt the user to enter the file names. The first parameter must be the name of the encryption key file, as described below. The second parameter must be the name of the file to be encrypted, as also described below. The sample run command near the end of this document contains an example of how the parameters will be entered.4. Your program should open the two files, echo the input to the screen, make the necessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below.Note: If the plaintext file to be encrypted doesn't have the proper number of alphabetic characters, pad the last block as necessary with the letter 'X'. It is necessary for us to do this so we can know what outputs to expect for our test inputs.

Answers

Answer: Provided in the explanation section

Explanation:

C++ Code

#include<iostream>

#include<fstream>

#include<string>

using namespace std;

// read plain text from file

void readPlaneText(char *file,char *txt,int &size){

  ifstream inp;

 

  inp.open(file);

 

  // index initialize to 0 for first character

 

  int index=0;

  char ch;

 

  if(!inp.fail()){

      // read each character from file  

      while(!inp.eof()){

          inp.get(ch);

          txt[index++]=ch;

      }

  }

 

  // size of message

  size=index-1;

}

// read key

int **readKey(char *file,int **key,int &size){

  ifstream ink;

 

  //

  ink.open(file);

      if(!ink.fail()){

         

          // read first line as size

      ink>>size;

     

      // create 2 d arry

      key=new int*[size];

     

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

          key[i]=new int[size];

      }

     

      // read data in 2d matrix

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

          for(int j=0;j<size;j++){

              ink>>key[i][j];

          }  

      }

  }

  return key;

}

// print message

void printText(string txt,char *msg,int size){

  cout<<txt<<":\n\n";

 

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

      cout<<msg[i];

  }

}

// print key

void printKey(int **key,int size){

  cout<<"\n\nKey matrix:\n\n";

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

      for(int j=0;j<size;j++){

          cout<<key[i][j]<<" ";

      }  

      cout<<endl;

  }

}

void encrypt(char *txt,int size,int **key,int kSize,char *ctxt){

  int *data=new int[kSize];

 

  for(int i=0;i<size;i=i+kSize){  

 

  // read key size concecutive data

      for(int a=0;a<kSize;a++){

          data[a]=txt[i+a]-'a';

      }

     

      // cipher operation

      for(int a=0;a<kSize;a++){

          int total=0;

          for(int b=0;b<kSize;b++){

              total+=key[a][b]*data[b];

          }  

          total=total%26;

          ctxt[i+a]=(char)('a'+total);

      }      

  }

}

int main(int argc,char **argv){

  char text[10000];

  char ctext[10000];

  int **key;

  int keySize;

  int size;

  // input

  key=readKey(argv[1],key,keySize);

  readPlaneText(argv[2],text,size);

  encrypt(text,size,key,keySize,ctext);

 

  // output

  printKey(key,keySize);

  cout<<endl<<endl;

  printText("Plaintext",text,size);

  cout<<endl<<endl;

  printText("Ciphertext",ctext,size);

 

  return 0;

}

cheers i hope this helped !!!

Consider a load-balancing algorithm that ensures that each queue has approximately the same number of threads, independent of priority. How effectively would a priority-based scheduling algorithm handle this situation if one run queue had all high-priority threads and a second queue had all low-priority threads

Answers

Answer and Explanation:

Consider giving greater priority to both the queue contains the national priority comment section as well as, therefore, first method the thread throughout this queue.If the item from either the major priority queue becomes decoupled, if the balancing between some of the number of comments in some of these two queues becomes disrupted, instead decouple one thread from either the queue comprising the low-value thread as well as position that one in the queue with the highest - priority loop to match the number of connections in such 2 queues.Whenever a new thread arrives with some kind of proper description, a friendly interface could've been introduced to just the queue contains fewer threads to achieve stability.

Therefore, the load-balancing requirements for keeping about the same number of threads would be retained and the meaningful matter of top priority thread would also be retained.

Based on the information given, it is important to give higher priority to the queue that contains the high priority thread.

Also, once an element from the high priority queue is dequeued, then dequeue one thread from the queue containing low priority thread and this will be enqueued into the queue having high priority thread in order to balance the number of threads.

Since the priority queue automatically adjusts the thread, hence the removal of the thread from one priority queue to another is not a problem.

Learn more about threads on:

https://brainly.com/question/8798580

In this challenge you will use the file regex_replace_challenge_student.py to:
Write a regular expression that will replace all occurrences of:
regular-expression
regular:expression
regular&expression
In the string: This is a string to search for a regular expression like regular expression or regular-expression or regular:expression or regular&expression
Assign the regular expression to a variable named pattern
Using the sub() method from the re package substitute all occurrences of the 'pattern' with 'substitution'
Assign the outcome of the sub() method to a variable called replace_result
Output to the console replace_results
Regular Expression Replace Challenge
The Python statement containing the string to search for the regular expression occurrence is below. search_string=’’’This is a string to search for a regular expression like regular expression or regular-expression or regular:expression or regular&expression’’’
Write a regular expression that will find all occurrences of:
a. regular expression
b. regular-expression
c. regular:expression
d. regular&expression in search_string
Assign the regular expression to a variable named pattern
The Python string below is used for substitution substitution="regular expression"
Using the sub() method from the re package substitute all occurrences of the ‘pattern’ with ‘substitution’
Assign the outcome of the sub() method to a variable called replace_result
Output to the console replace_results
import re
#The string to search for the regular expression occurrence (This is provided to the student)
search_string='''This is a string to search for a regular expression like regular expression or
regular-expression or regular:expression or regular&expression'''
#1. Write a regular expression that will find all occurrances of:
# a. regular expression
# b. regular-expression
# c. regular:expression
# d. regular&expression
# in search_string
#2. Assign the regular expression to a variable named pattern
#The string to use for subsitution (This is provided to the student)
substitution="regular expression"
#3. Using the sub() method from the re package substitute all occurrences of the 'pattern' with 'substitution'
#4. Assign the outcome of the sub() method to a variable called replace_result
#5. Output to the console replace_results

Answers

Answer:

Please follow the code indentation for the python program.

Explanation:

Write the class "Tests". Ensure that it stores a student’s first name, last name, all five test scores, the average of those 5 tests’ scores and their final letter grade. (Use an array to store all test scores.)

Answers

Answer:

The following assumption will be made for this assignment;

If average score is greater than 75, the letter grade is AIf average score is between 66 and 75, the letter grade is BIf average score is between 56 and 65, the letter grade is CIf average score is between 46 and 55, the letter grade is DIf average score is between 40 and 45, the letter grade is EIf average score is lesser than 40, the letter grade is F

The program is written in Java and it uses comments to explain difficult lines. The program is as follows

import java.util.*;

public class Tests

{

public static void main(String [] args)

{

 //Declare variables

 Scanner input = new Scanner(System.in);

 String firstname, lastname;

 //Prompt user for name

 System.out.print("Enter Lastname: ");

 lastname = input.next();

 System.out.print("Enter Firstname: ");

 firstname = input.next();

 char grade;

 //Declare Array

 int[] Scores = new int[5];

 //Initialize total scores to 0

 int total = 0;  

  //Decalare Average

  double   average;

 //Prompt user for scores

 for(int i =0;i<5;i++)

 {

  System.out.print("Enter Score "+(i+1)+": ");

  Scores[i] = input.nextInt();

  //Calculate Total Scores

  total+=Scores[i];

 }

 //Calculate Average

 average = total/5.0;

 //Get Letter Grade

 if(average>75)

 {

 grade = 'A';

 }

 else if(average>65)

 {

 grade = 'B';

 }

 else if(average>55)

 {

 grade = 'C';

 }

 else if(average>45)

 {

 grade = 'D';

 }

 else if(average>40)

 {

 grade = 'E';

 }

 else

 {

 grade = 'F';

 }

 //Print Student Results

 System.out.print("Fullname: "+lastname+", "+firstname);

 System.out.print('\n');

 System.out.print("Total Scores: "+total);

 System.out.print('\n');

 System.out.print("Average Scores: "+average);

 System.out.print('\n');

 System.out.print("Grade: "+grade);

}

}

See Attachment for .java file

5. Write a C++ program that can display the output as shown below. Your
program will calculate the price after discount. User will input the
price and the discount is 20%


Answers

Answer:

#include<iostream>

using namespace std;

int main()

{

float price;

float discount;

cout<<"enter price : ";

cin>>price;

discount=price - (price * 20 / 100);

cout<<"discount rate is :"<<discount;

}

Explanation:

Suppose that the following two classes have been declared public class Car f public void m1) System.out.println("car 1"; public void m2) System.out.println("car 2"); public String toString) f return "vroom"; public class Truck extends Car public void m1) t System.out.println("truck 1"); public void m2) t super.m1); public String toString) t return super.toString) super.toString ); Write a class MonsterTruck whose methods have the behavior below. Don't just print/return the output; whenever possible, use inheritance to reuse behavior from the superclass Methog Output/Return monster 1 truck1 car 1 m2 toString "monster vroomvroom'" Type your solution here:

Answers

Answer: provided in the explanation section

Explanation:

// code to copy

Car.java

public class Car {

 

  public void m1()

  {

  System.out.println("car 1");

}

 

  public void m2() {

      System.out.println("car 2");

}

 

  public String toString()

  {

  return "vroom";

}

 

}

Truck.java

public class Truck extends Car{

 

  public void m1()

  {

  System.out.println("truck 1");

  }

 

  public void m2()

  {

  super.m1();

  }

 

  public String toString()

  {

      return super.toString() + super.toString();

  }

}

MonsterTruck​​​​​​​.java

public class MonsterTruck extends Truck

{

  public void m1() {

System.out.println("monster 1");

}

 

public void m2() {

super.m1();

super.m2();

}

 

public String toString() {

return "monster " + super.toString();

}

public static void main(String[] args) {

  MonsterTruck mt=new MonsterTruck();

  mt.m1();

  mt.m2();

  System.out.println(mt);

}

}

cheers i hope this helped !!!

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, or a total of $650. Write an app (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is an integer). a) $200–299
b) $300–399
c) $400–499
d) $500–599
e) $600–699
f) $700–799
g) $800–899
h) $900–999
i) $1000 and over
Summarize the results in tabular format.

Answers

Answer: Provided in the explanation section

Explanation:

import java.util.Scanner;

public class commission

{

   public static void main(String[] args) {

      Scanner input = new Scanner(System.in);

        int totals[]={0,0,0,0,0,0,0,0,0};          

      int n,sales,i,index;

       double salary;

        System.out.print("how many salesmen do you have? ");                          

      n=input.nextInt();

        for(i=1;i<=n;i++)

           {System.out.print("Salesman "+i+" enter sales: ");

            sales=input.nextInt();

            salary=200+(int)(.09*sales);

               System.out.printf("Salary=$%.2f\n",salary);

            index=(int)salary/100-2;

            if(index>8)

                index=8;

            totals[index]++;

            }

        System.out.println("SUMMARY\nSALES\t\tCOUNT");

        for(i=0;i<8;i++)

           System.out.println("$"+(i*100+200)+"-"+(i*100+299)+"\t"+totals[i]);

        System.out.println("$1000 and over\t"+totals[i]);

       }                                

   }

 

cheers i  hope this helped !!      

What’s the best way to figure out what wires what and goes where?

Answers

Try to untangle them, First!
Then the color of the wire must match the color hole it goes in (I’m guessing)
I’m not good with electronics so sorry.

Write a function named file_stats that takes one string parameter (in_file) that is the name of an existing text file. The function file_stats should calculate three statistics about in_file i.e. the number of lines it contains, the number of words and the number of characters, and print the three statistics on separate lines.

For example, the following would be be correct input and output. (Hint: the number of characters may vary depending on what platform you are working.)
>>> file_stats('created_equal.txt')

lines 2
words 13
characters 72

Answers

Answer:

Here is the Python program.

characters = 0

words = 0

lines = 0

def file_stats(in_file):

   global lines, words, characters

   with open(in_file, 'r') as file:

       for line in file:

           lines = lines + 1

           totalwords = line.split()

           words = words + len(totalwords)

           for word in totalwords:

               characters= characters + len(word)

file_stats('created_equal.txt')

print("Number of lines: {0}".format(lines))

print("Number of words: {0}".format(words))

print("Number of chars: {0}".format(characters))

   

Explanation:

The program first initializes three variables to 0 which are: words, lines and characters.

The method file_stats() takes in_file as a parameter. in_file is the name of the existing text file.

In this method the keyword global is used to read and modify the variables words, lines and characters inside the function.

open() function is used to open the file. It has two parameters: file name and mode 'r' which represents the mode of the file to be opened. Here 'r' means the file is to be opened in read mode.

For loop is used which moves through each line in the text file and counts the number of lines by incrementing the line variable by 1, each time it reads the line.

split() function is used to split the each line string into a list. This split is stored in totalwords.

Next statement words = words + len(totalwords)  is used to find the number of words in the text file. When the lines are split in to a list then the length of each split is found by the len() function and added to the words variable in order to find the number of words in the text file.

Next, in order to find the number of characters, for loop is used. The loop moves through each word in the list totalwords and split each word in the totalwords list using split() method. This makes a list of each character in every word of the text file. This calculates the number of characters in each word. Each word split is added to the character and stored in character variable.

file_stats('created_equal.txt')  statement calls the file_stats() method and passes a file name of the text file created_equal.txt as an argument to this method. The last three print() statements display the number of lines, words and characters in the created_equal.txt text file.

The program along with its output is attached.

Enter a formula in cell C9 using the PMT function to calculate the monthly payment on a loan using the assumptions listed in the Status Quo scenario. In the PMT formula, use C6 as the monthly interest rate (rate), C8 as the total number of payments (nper), and C4 as the loan amount (pv). Enter this formula in cell C9, and then copy the formula to the range D9:F9.

Answers

Answer:

=PMT(C6,C8,C4)

Put that in cell c9

Then use the lower right of the cell to drag it from D9:F9

In this exercise we have to use excel knowledge, so we have to:

=PMT(C6,C8,C4) in the cell C9 and extended to D9:F9

How is PMT calculated in Excel?

PMT, one of the financial functions, calculates the payment for a loan based on constant payments and a constant interest rate. Use the Excel Formula Coach to figure out a monthly loan payment.

For this we need to put the form as:

=PMT(C6,C8,C4)

See more about excel at brainly.com/question/12788694

Chris wants to view a travel blog her friend just created. Which tool will she use?

HTML
Web browser
Text editor
Application software

Answers

Answer:

i think html

Explanation:

Answer:

Web browser

Explanation:

Write a program that displays a menu allowing the user to select air, water, or steel, and then has the user enter the number of feet a sound wave will travel in the selected medium. The program should then compute and display (with four decimal places) the number of seconds it will take. Your program should check if the user enters a valid menu choice, if not, it should terminate with an appropriate message.

Answers

Answer:

yooooooooooooooooooooo

Explanation:

Write a basic program that performs simple file and mathematical operations.
a. Write a program that reads dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the find() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990.
b. After the program is working as above, modify the program so that it reads all dates from an input file "inputDates.txt" (an Example file is attached).
c. Modify your program further so that after parsing all dates from the input file "inputDates.txt", it writes out the correct ones into an output file called: "parsedDates.txt".
Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003

Answers

Answer:

Explanation:

I have written the Python program based on your requirements.

Just give the path of the input file and the path for the output file correctly where you want to place the output file.

In, my code - I have given my computer's path to the input and output file.

You just change the path correctly

My code works perfectly and I have tested the code with your inputs.

It gives the exact output that you need.

I have attached the Output that I got by running the below program.

Code:

month_list={ "january":"1","february":"2", "march":"3","april":"4", "may":"5", "june":"6","july":"7", "august":"8", "september":"9","october":"10", "november":"11", "december":"12"} input_file=open('C:\\Users\\Desktop\\inputDates.txt', 'r') output_file=open('C:\\Users\\Desktop\\parsedDates.txt','w') for each in input_file: if each!="-1": lis=each.split() if len (lis) >=3: month=lis [0] day=lis[1] year=lis [2] if month.lower() in month_list: comma=day[-1] if comma==',': day=day[:len (day)-1] month_number=month_list[month.lower()] ans-month_number+"/"+day+"/"+year output_file.write (ans) output_file.write("\n") output_file.close() input_file.close()

- O X parsedDates - Notepad File Edit Format View Help 3/1/1990 12/13/2003

- X inputDates - Notepad File Edit Format View Help March 1, 1990 April 2 1995 7/15/20 December 13, 2003 -1

cheers i hope this helped !!

In this exercise we have to use the knowledge in computer language to write a code in python, like this:

the code can be found in the attached image

to make it simpler we have that the code will be given by:

month_list ={"january": "1", "february": "2", "march": "3", "april": "4", "may": "5", "june": "6", "july": "7", "august": "8", "september": "9", "october": "10", "november": "11", "december":"12"}

input_file = open ('C:\\Users\\Desktop\\inputDates.txt', 'r') output_file =

open ('C:\\Users\\Desktop\\parsedDates.txt', 'w') for each

in input_file:if each

 !="-1":lis = each.split ()if len

   (lis) >= 3:month = lis[0] day = lis[1] year = lis[2] if month

    .lower ()in month_list:comma = day[-1] if comma

    == ',': day = day[:len (day) - 1] month_number =

 month_list[month.lower ()]ans - month_number + "/" + day + "/" +

 year output_file.write (ans) output_file.write ("\n") output_file.

 close ()input_file.close ()

See more about python at brainly.com/question/26104476

Identify a logical operation (along
with a corresponding mask) that, when
applied to an input string of 8 bits,
produces an output string of all 0s if and
only if the input string is 10000001.​

Answers

Answer: Provided in the explanation section

Explanation:

The Question says;

Identify a logical operation (along

with a corresponding mask) that, when

applied to an input string of 8 bits,

produces an output string of all 0s if and

only if the input string is 10000001.​

The Answer (Explanation):

XOR, exclusive OR only gives 1 when both the bits are different.

So, if we want to have all 0s, and the for input only 10000001, then we have only one operation which satisfies this condition - XOR 10000001. AND

with 00000000 would also give 0,

but it would give 0 with all the inputs, not just 10000001.

Cheers i hope this helped !!

How are a members details be checked and verified when they return to log back in to the website ?

Answers

Answer:

When you sign into a website, you have to enter a password and username most of the time, which will allow the website to know that you have checked in and it is you, who is using your account.

Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue accepting scores until the user enters a negative value. Finally, calculate and display the average for the entered scores.

Answers

Answer:

total = 0

count = 0

while(True):

   grade = float(input("Enter a grade: "))

   if grade < 0:

       break

   else:

       total += grade

       count += 1

       

average = total/count

print("The average is: " + str(average))

Explanation:

*The code is in Python.

Initialize the total and count as 0

Create a while loop that iterates until a specific condition is met inside the loop

Inside the loop, ask the user to enter a grade. If the grade is smaller than 0, stop the loop. Otherwise, add the grade to the total and increment the count by 1.

When the loop is done, calculate the average, divide the total by count, and print it

Write an INSERT statement that adds these rows to the Invoice_Line_Items table:
invoice_sequence: 1 2
account_number: 160 527
line_item_amount: $180.23 $254.35
line_item_description: Hard drive Exchange Server update
Set the invoice_id column of these two rows to the invoice ID that was generated
by MySQL for the invoice you added in exercise 4.

Answers

Answer:

Insertion query for first row :

INSERT into Invoice_Line_Items (invoice_sequence, account_number, line_item_amount, line_item_description) Values (1, 160, '$180.23', "Hard drive Exchange");

Insertion query for second row :

INSERT into Invoice_Line_Items (invoice_sequence, account_number, line_item_amount, line_item_description) Values (2, 527, '$254.35', "Server update");

Explanation:

* In SQL for insertion query, we use INSERT keyword which comes under DML (Data manipulation Language).

* Statement is given below -

INSERT into Table_name  (column1, column2, ....column N) Values (value1, value2, .....value N);

* With the use of INSERT query we can insert value in multiple rows at a same time in a table which reduces our work load.

) If FIFO page replacement is used with five page frames and eight pages, how many page faults will occur with the reference string 236571345157245 if the five frames are initially empty?

Answers

Answer:

There are a total of 8 page faults.

Explanation:

In FIFO page replacement, the requests are executed as they are received. The solution is provided in the attached figure. The steps are as follows

Look for the digit in the pages. if they are available, there is no page fault. If the digit does not exist in the page frames it will result in an error.

Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning of the expression. Apply De Morgan's law until each negation operation applies directly to a predicate and then translate the logical expression back into English.
Sample question: Some patient was given the placebo and the medication. ∃x (P(x) ∧ D(x)) Negation: ¬∃x (P(x) ∧ D(x)) Applying De Morgan's law: ∀x (¬P(x) ∨ ¬D(x)) English: Every patient was either not given the placebo or not given the medication (or both).(a) Every patient was given the medication.(b) Every patient was given the medication or the placebo or both.(c) There is a patient who took the medication and had migraines.(d) Every patient who took the placebo had migraines. (Hint: you will need to apply the conditional identity, p → q ≡ ¬p ∨ q.)

Answers

Answer:

Explanation:

To begin, i will like to break this down to its simplest form to make this as simple as possible.

Let us begin !

Here statement can be translated as: ∃x (P(x) ∧ M(x))

we require the Negation: ¬∃x (P(x) ∧ M(x))

De morgan's law can be stated as:

1) ¬(a ∧ b) = (¬a ∨ ¬b)

2) ¬(a v b) = (¬a ∧ ¬b)

Also, quantifiers are swapped.

Applying De Morgan's law, we have: ∀x (¬P(x) ∨ ¬M(x)) (∃ i swapped with ∀ and intersecion is replaced with union.)

This is the translation of above

English: Every patient was either not given the placebo or did not have migrane(or both).

cheers i hope this helped !!

(Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, If the user entered month 2 and year 2012, the program should display that February 2012 has 29 days. If the user entered month 3 and year 2015, the program should display that March 2015 has 31 days.

Answers

it would be a table program. you can add a table and put your data into the table

windows can create a mirror set with two drives for data redundancy which is also known as​

Answers

Answer:

Raid

Explanation:

What program is best for teaching young people code?

Answers

I’d probably say scratch, Its great for young people to learn how to code. Lots of things you can do and make with it.

Suppose you have 9 coins and one of them is heavier than others. Other 8 coins weight equally. You are also given a balance. Develop and algorithm to determine the heavy coin using only two measurements with the help of the balance. Clearly write your algorithm in the form of a pseudocode using the similar notation that we have used in the class to represent sorting algorithms

Answers

Answer:

Following are the algorithm to this question:

Find_Heavier_Coins(Coin[9]):

   i) Let Coin[] Array represent all Coins.  

   ii) Divide coin[] into 3 parallel bundles and each has three coins, example 0-2, 3-5, 6-8 indicate a1 a2 a3

   iii) Randomly select any two bundles and place them in balance [say a1 and a2]

   iv) If Weigh of a1 and a2 has same:

           // checking that if a3 has heavier coin

           Choose any two 6-8 coins and place them onto balance [say 6 and 8]

           If those who weigh has the same weight:

               Third coin is coin heavier [say 7]

           else:  

               The coin [6 or 8] is the one which is heavier on the balance

       else:

           //The coin has the package which would be heavier on the balance [say a1]

           Select any two coins on balance from of the heavier package [say 0 and 1]

   If they weigh the same weight:

       Third coin is coin heavier [say 2]

   else:

       The coin that is heavier on the balance is the [or 0]

Explanation:

In the above-given algorithm code, a method Find_Heavier_Coins is declared which passes a coin[] array variable in its parameters. In the next step, if conditional block is used that checks the values which can be described as follows:

In the first, if block is used that checks a1 and a2 values and uses another if block in this it will print a3 value, else it will print 6 to 8 value. In the another, if the block it will check  third coins value and prints its value if it is not correct it will print first coin value

An introduction to object-oriented programming.
Write a GUI program named EggsInteractiveGUI that allows a user to input the number of eggs produced in a month by each of five chickens. Sum the eggs, then display the total in dozens and eggs. For example, a total of 127 eggs is 10 dozen and 7 eggs.

Answers

Answer:

The csharp program is given below.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

   public partial class Form1 : Form

   {

       public Form1()

       {

           InitializeComponent();

      }

       private void button6_Click(object sender, EventArgs e)

       {

           int total = (Convert.ToInt32(textBox1.Text) +  Convert.ToInt32(textBox2.Text) + Convert.ToInt32(textBox3.Text) + Convert.ToInt32(textBox4.Text) + Convert.ToInt32(textBox5.Text));

           int dozen = total / 12;

           int eggs = total % 12;

           textBox6.Text = dozen.ToString();

           textBox7.Text = eggs.ToString();

       }

       private void button7_Click(object sender, EventArgs e)

       {

           textBox1.Text = "";

           textBox2.Text = "";

           textBox3.Text = "";

           textBox4.Text = "";

           textBox5.Text = "";

           textBox6.Text = "";

           textBox7.Text = "";

       }

        private void button8_Click(object sender, EventArgs e)

       {

           Close();

       }

    }

}

Explanation:

1. The integer variables are declared for total eggs, number of dozens and number of eggs.

2. The input of each text box is converted into integer by using the Convert.ToInt32() method on the value of that particular text box.

3. All the inputs are added and the sum is assigned to variable, total.

4. The number of dozens are obtained by dividing total by 12 and assigning the value to the variable, dozen.

5. The number of extra eggs are obtained by taking the modulus of total and 12 and the value is assigned to the variable, eggs.

6. The integer values in the variables, dozen and eggs, are converted into string using the ToString() function with that particular value.

dozen.ToString();

eggs.ToString();

7. The text boxes are assigned the respective values of dozens and number of eggs.

textBox6.Text = dozen.ToString();

textBox7.Text = eggs.ToString();

8. Two additional buttons, clear and exit, are also added.

9. The clear button erases the contents of all the text boxes. The Text property of each textbox is set to “” thereby clearing all the text fields.

10. The exit button closes the application using Close() function.

11. The program is made in visual studio and the output is attached.

In 1987, Congress passed the Computer Security Act (CSA). This was the first law to address federal computer security. Under the CSA, every federal agency had to inventory its IT systems. Agencies also had to create security plans for those systems and review their plans every year.
A. True
B. False

Answers

Answer:

A.) True is the answer hope it helps

Which of the following does Google use to display the characters of the page’s meta title?

Answers

Explanation:

search engine because it helps to search find what you are expecting to search in the google.

Write a Python program that can compare the unit (perlb) cost of sugar sold in packages with different weights and prices. The program prompts the user to enter the weight and price of package 1, then does the same for package 2, and displays the results to indicate sugar in which package has a better price. It is assumed that the weight of all packages is measured in lb. The program should check to be sure that both the inputs of weight and price are both positive values.

Answers

Answer:

This program is written using python

It uses less comments (See explanation section for more explanation)

Also, see attachments for proper view of the source code

Program starts here

#Prompt user for price of package 1

price1 = int(input("Enter Price 1: "))

while(price1 <= 0):

     price1 = int(input("Enter Price 1: "))

#Prompt user for weight of package 1

weight1 = int(input("Enter Weight 1: "))

while(weight1 <= 0):

     weight1 = int(input("Enter Weight 1: "))

#Calculate Unit of Package 1

unit1 = float(price1/weight1)

print("Unit cost of Package 1: "+str(unit1))

#Prompt user for price of package 2

price2 = int(input("Enter Price 2: "))

while(price2 <= 0):

     price2 = int(input("Enter Price 2: "))

#Prompt user for weight of package 2

weight2 = int(input("Enter Weight 2: "))

while(weight2 <= 0):

     weight2 = int(input("Enter Weight 2: "))

#Calculate Unit of Package 2

unit2 = float(price2/weight2)

print("Unit cost of Package 2: "+str(unit2))

#Compare units

if unit1 > unit2:

     print("Package 1 has a better price")

elif unit1 == unit2:

     print("Both Packages have the same price")

else:

     print("Package 2 has a better price")

Explanation:

price1 = int(input("Enter Price 1: ")) -> This line prompts the user for price of package 1

The following while statement is executed until user inputs a value greater than 1 for price

while(price1 <= 0):

     price1 = int(input("Enter Price 1: "))

weight1 = int(input("Enter Weight 1: ")) -> This line prompts the user for weight of package 1

The following while statement is executed until user inputs a value greater than 1 for weight

while(weight1 <= 0):

     weight1 = int(input("Enter Weight 1: "))

unit1 = float(price1/weight1) -> This line calculates the unit cost (per weight) of package 1

print("Unit cost of Package 1: "+str(unit1)) -> The unit cost of package 1 is printed using this print statement

price2 = int(input("Enter Price 2: ")) -> This line prompts the user for price of package 2

The following while statement is executed until user inputs a value greater than 1 for price

while(price2 <= 0):

     price2 = int(input("Enter Price 2: "))

weight2 = int(input("Enter Weight 2: ")) -> This line prompts the user for weight of package 2

The following while statement is executed until user inputs a value greater than 1 for weight

while(weight2 <= 0):

     weight2 = int(input("Enter Weight 2: "))

unit2 = float(price2/weight) -> This line calculates the unit cost (per weight) of package 2

print("Unit cost of Package 2: "+str(unit2)) -> The unit cost of package 2 is printed using this print statement

The following if statements compares and prints which package has a better unit cost

If unit cost of package 1 is greater than that of package 2, then package 1 has a better priceIf unit cost of both packages are equal then they both have the same priceIf unit cost of package 2 is greater than that of package 1, then package 2 has a better price

if unit1 > unit2:

     print("Package 1 has a better price")

elif unit1 == unit2:

     print("Both Packages have the same price")

else:

     print("Package 2 has a better price")

Programming CRe-type the code and fix any errors. The code should convert non-positive numbers to 1.
if (userNum > 0)
printf("Positive.\n");
else
printf("Non-positive, converting to 1.\n");
user Num = 1;
printf("Final: %d\n", userNum);
1 #include Hem
int main(void) {
int userNum;
scanf("%d", &userNum);
return 0;

Answers

Answer:

Given

The above lines of code

Required

Rearrange.

The code is re-arrange d as follows;.

#include<iostream>

int main()

{

int userNum;

scanf("%d", &userNum);

if (userNum > 0)

{

printf("Positive.\n");

}

else

{

printf("Non-positive, converting to 1.\n");

userNum = 1;

printf("Final: %d\n", userNum);

}

return 0;

}

When rearranging lines of codes. one has to be mindful of the programming language, the syntax of the language and control structures in the code;

One should take note of the variable declarations and usage

See attachment for .cpp file

Numbering exception conditions, which often uses hierarchical numbering, in a fully developed use case description is helpful to _______.​ a. ​ tie the exception condition to a processing step b. ​ show which exception conditions are subordinate to other exceptions c. ​ provide an identifier for each exception condition d. ​ tie exception conditions to other diagrams or descriptions

Answers

Answer:

a) tie the exception condition to a processing step

Explanation:

Numbering exception conditions, in a fully developed use case description is helpful to tie the exception condition to a processing step

The fully developed use case description is useful for the documentation of the context, purpose, description, conditions, and workflow of each use case. Activity diagrams give a graphical image of the use case workflow and serve the purpose of illustrating the alternative paths through a business process.

Compute -ABE16-DF416 using 15’s complement

Answers

Answer:

33600

Explanation:

Let M = ABE16

and N = DF416

In hexadecimal representation: 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F

Step 1: Find the 15's complement of N

 F  F  F  F  F

- D  F  4  1  6

2  0  B  E  9

Step 2: Add 15's complement of N to M

  A  B  E  1  6

+ 2  0  B  E  9  

  C  C  9  F  F

Step 3: Find the 15's complement of CC9FF

 F  F   F  F  F

- C  C  9  F  F

 3   3  6  0  0

Therefore, ABE16 - DF416 using 15's complement is 33600

Other Questions
Buying new clothes so that your friends will stop making fun of your old clothes a positive reinforcement or negative reinforcement? find four rational numbers between 2/3 and 3/4 Question 2 of 102 PointsWhich of the following best explains how consumers' purchases influence thedecisions of producers?O A. Producers can figure out what consumers are willing to pay basedon what they buy.B. Producers can judge whether they have an efficient production process based on what consumers buy.O C. Producers can determine how best to reduce waste by knowing what consumers don't buy.O D. Producers can predict the effects of new technolothe technologies used by consumers.the answer A. Producers can figure out what consumers are willing to pay based on what they buy. Nous ________ voir des pandas au zoo. esprons esprez espre sprent The value of m compared to the standard is1/100010001/10010 countries of Africa 1. How does the equations help explain the role of producers in the ecosystem?1. Producers create energy for other organisms to consume.2. Producers convert sunlight into usable energy and Nitrogen.3. Producers convert carbon dioxide and water into sugar.4. Producers create Carbon dioxide for other organisms.2. Aerobic Cellular Respiration is important to organisms because1. It allows plants to produce sugar for food.2. It releases the oxygen needed by plants for photosynthesis.3. It converts sugars to usable energy that all organisms need.4. It helps animals digest the sugars when they eat plants. The article "A Shovel with a perforated blade reduces energy expenditure required for digging wet clay" (Human Factors, 2010:492-502) reported on an experiment in which each of 13 workers was provided with both a conventional shovel and a shovel whose blade was perforated with small holes. The authors of the cited article provided the following data on stable energy expenditure (measured in kilocalories per kg of subject per pounds of clay): 1 2 3 4 5 6 7 8 9 10 11 12 13 Worker Conventional 0.0011 0.0014 0.0018 0.0022 0.001 0.0016 0.0028 0.002 0.0015 0.0023 0.0017 0.002 0.0014 Perforated 0.0011 0.001 0.0019 0.0013 0.0011 0.0017 0.0024 0.002 0.0013 0.0017 0.002 0.0013 0.0013 Carry out a test of hypotheses at significance level 0.05 to see whether the true average energy expenditure using the conventional shovel exceeds that using the perforated shovel. (hint: this is a paired-design!). Make sure to calculate a p-value! identify the domain and range of y = 4x - 5 + 3 Expand and simplify ( 2 + 3)to the power of 2 The fraction of students ages 10 to 17 who favor math or science is Which statement best describes India?Projected to become a leading world economic power, it provides information technology and software services to other countries.Formerly part of the Soviet Union, it is now an independent, industrialized nation governed by a Maharajah.Moving from underdeveloped nation to developing nation, it provides agricultural products to all of Southeast Asia.Once a developing nation, it is now an urbanized country with an economy based on oil. vectorsPre-TestActive123456THE REMAINI24:13Two vectors, X and Y, form a right angle. Vector X is 48 inches long and vector Y is 14 inches long. The length of the resultantvector isinches. According to critics the present trend towards global economic interaction threatens ASAP! GIVING BRAINLIEST! Please read the question THEN answer CORRECTLY! NO guessing. I say no guessing because people usually guess on my questions. TRUE OR FALSE As the human population increases, demand for natural resources will also increase. What does Juliet speak to her father about before taking the potion? Simplify the answer pls Wattan Company reports beginning inventory of 10 units at $60 each. Every week for four weeks it purchases an additional 10 units at respective costs of $61, $62, $65, and $70 per unit for weeks 1 through 4. Compute the cost of goods available for sale and the units available for sale for this four-week period. Assume that no sales occur during those four weeks. can someone help me on these 2 questions?