Modify your "Star Search" program to read 100 scores from a text file, then execute the "Star Search" algorithm (drop the lowest and highest scores, then average the rest) and display the result, with three digits after the decimal point. As per the Star Search specifications, only scores from 0 - 10 will be accepted. Any score that is outside that range is to be rejected, and is not included in the average. That means that invalid scores can't be the high or low scores either. For example (using 10 scores): if the list is 6.1 -5.1 2.0 3.5 5.8 2.0 12.9 5.0 9.9 10.0 The -5.1 and 12.9 are rejected as invalid (not in the range 0-10). 2.0 and 10.0 are the low and high scores to be dropped. The remaining SIX scores are averaged. If you wish to use this data for testing, the answer is 5.383

Answers

Answer 1

Answer:

See explaination

Explanation:

#include <fstream>

#include <iostream>

#include <iomanip>

#include <cstring>

#include <cstdlib>

#include <ctime>

#include <vector>

using namespace std;

void getJudgeData(double &score);

double calcScore(double scores[]);

int findLowest(double scores[]);

int findHighest(double scores[]);

int main() {

const int COL=5;

int row;

double score;

cout<<"How many students data you want to enter ? ";

cin>>row;

// Creating 2-D array Dynamically

double** scores = new double*[row];

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

scores[i] = new double[COL];

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

{

cout<<"\nPerformer#"<<(i+1)<<":"<<endl;

for(int j=0;j<COL;j++)

{

cout<<"Enter Score given by judge#"<<(j+1)<<":";

getJudgeData(scores[i][j]);

}

}

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

{

cout<<"Performer#"<<(i+1)<<" score :"<<calcScore(scores[i])<<endl;

}

return 0;

}

void getJudgeData(double &score)

{

while(true)

{

cin>>score;

if(score<0 || score>10)

{

cout<<"Invalid.Must be between 0-10"<<endl;

cout<<"re-enter :";

}

else

{

break;

}

}

}

double calcScore(double scores[])

{

double sum=0;

int min= findLowest(scores);

int max= findHighest(scores);

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

{

if(i!=min && i!=max)

{

sum+=scores[i];

}

}

return sum/3;

}

int findLowest(double scores[])

{

double min=scores[0];

int minIndex=0;

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

{

if(min>scores[i])

{

min=scores[i];

minIndex=i;

}

}

return minIndex;

}

int findHighest(double scores[])

{

double max=scores[0];

int maxIndex=0;

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

{

if(max<scores[i])

{

max=scores[i];

maxIndex=i;

}

}

return maxIndex;

}


Related Questions

What is the fastest typing speed ever recorded? Please be specific!

Answers

Answer:

250 wpm for almost an hour straight. This was recorded by Barbara Blackburn in 1946.

An attacker compromises the Washington Post's web server and proceeds to modify the homepage slightly by inserting a 1x1 pixel iframe that directs all website visitors to a webpage of his choosing that then installs malware on the visitors' computers. The attacker did this explicitly because he knows that US policymakers frequent the website. This would be an example of a ___________ attack.

Answers

Answer:

Water holing is the correct answer to this question.

Explanation:

Waterholing:-

It is a kind of attack in which the attacker detects the sites that the targets of the group frequently access and then afflicts the sites with the ransomware. Which afflicts selected representatives of the target group.

The watering hole assault is a data breach wherein the individual attempts to infiltrate a particular demographic of end-users by harming sites reported to be visited by team members. The aim is to compromise a specific target data and gain network access at the perpetrator's place of work.

Write a static method named contains that accepts two arrays of integers a1 and a2 as
parameters and that returns a boolean value indicating whether or not a2's sequence of
elements appears in a1 (true for yes, false for no). The sequence of elements in a2 may
appear anywhere in a1 but must appear consecutively and in the same order. For example, if
variables called list1 and list2 store the following values:

int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8};
int[] list2 = {1, 2, 1};

Then the call of contains(list1, list2) should return true because list2's sequence of
values {1, 2, 1} is contained in list1 starting at index 5. If list2 had stored the values {2,
1, 2}, the call of contains(list1, list2) would return false because list1 does not
contain that sequence of values. Any two lists with identical elements are considered to contain
each other, so a call such as contains(list1, list1) should return true.

Answers

Answer:

Sew explaination foe code

Explanation:

import java.lang.*;

import java.util.*;

import java.io.*;

class Main

{

public static Boolean checkSubset(int[] list1, int[] list2)

{

int l = list2.length;

for(int i = 0; i<list1.length-l; i++)

{

Boolean flag = true;

for(int j = 0; j<list2.length; j++)

{

if(list1[i+j] != list2[j])

{

flag = false;

break;

}

}

if(flag) return true;

}

return false;

}

public static void main(String args[])

{

int[] l1 = {1,6,2,1,4,1,2,1,8};

int[] l2 = {1,2,2};

System.out.println(checkSubset(l1,l2));

}

}

Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) with the corresponding number. Remember that the factorial of a number is defined as the product of an integer and all integers before it. For example, the factorial of five (5!) is equal to 1*2*3*4*5

Answers

Answer:

Following are code of factorial in python language

def factorial(n): # function

   result=1 #variable

   for x in range(2,n+1): #iterating the loop

       result=result*x  #storing result

   return result #return result

for n in range(10): #iterating loop

   print(n,factorial(n)) #print factorial

Output:

Following are the attachment of output

Explanation:

Missing information :

In the question the information is missing the code is missing which we have to correct it following are the code that are mention below.

def factorial(n): # function

   result=1 #variable

   for x in range(       ): #iterating the loop

       result=  #storing result

   return  #return result

for n in range(  ): #iterating loop

   print(n,factorial(n)) #print factorial

Following are the description of code

We have create a function factorial  in this we have pass the one parameter i.e "n".In the for loop we have pass 2,n+1 which has been used to iterating the loop calculating factorial and string the result in the result variable In the main function we have pass the range on which we have to calculated the factorialFinally the print function will print the factorial .

Following are the attachment snip of code in the python language

By filling in the blanks to make the factorial function return the factorial of n, we have the following.

def factorial (n):

 result = 1

 for x in range(2, n+1):

   result = result*x

 return result

for n in range(10):

 print(n,factorial(n))

The math module in Python includes a number series of mathematical operations that may be easily done using the module. The math . factorial() function computes the factorial of a given number.

To write the code perfectly and fill in the blanks:

We created a math factorial function with n parameterThis code is being passed through the iterating loop 2,n+1 for calculation. We string the result, perform the range, and print out the result using the print formula.

CODE:

def factorial (n):

 result=1

 for x in range(2, n+1):

   result = result*x

 return result

for n in range(10):

 print(n,factorial(n))

RESULT:

0 1

1 1

2 2

3 6

4 24

5 120

6 720

7 5040

8 40320

9 362880

Therefore, we can conclude that we've understood how to write the factorial function code in python.

Learn more about python coding here:

https://brainly.com/question/1351889?referrer=searchResults

Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of type int. A static int data member named nCounters. A constructor that takes an int argument. A function called increment that accepts no parameters and returns no value. A function called decrement that accepts no parameters and returns no value. A function called getValue that accepts no parameters and returns an int. A function named getCounterID that accepts no parameters and returns an int.

Answers

Explanation:

See the attached image for The interface (.h file) of a class Counter

In Java please:
Palindrome reads the same from left or right, mom for example. There is a palindrome which must be modified, if possible. Change exactly one character of the string to another character in the range ascii[a-z] so that the string meets the following three conditions:
a. The new string is lower alphabetically than the initial string.
b. The new string is the lowest value string alphabetically that can be created from the original palindrome after making only one change.
c. The new string is not a palindrome.
Return the new string, or, if it not possible to create a string meeting the criteria, return the string IMPOSSIBLE.
Example:
palindromeStr = 'aaabbaaa'
O Possible strings lower alphabetically than 'aaabbaaa' after one change are [aaaabaaa', 'aaabaaaa').
O aaaabaaa' is not a palindrome and is the lowest string that can be created from palindromeStr.

Answers

Answer:

See explaination

Explanation:

public class PalindromeChange {

public static void main(String[] args) {

System.out.println("mom to non palindrom word is: "+changTONonPalindrom("mom"));

System.out.println("mom to non palindrom word is: "+changTONonPalindrom("aaabbaaa"));

}

private static String changTONonPalindrom(String str)

{

int mid=str.length()/2;

boolean found=false;

char character=' ';

int i;

for(i=mid-1;i>=0;i--)

{

character = str.charAt(i);

if(character!='a')

{

found=true;

break;

}

}

if(!found)

{

for(i=mid+1;i<str.length();i++)

{

character = str.charAt(i);

if(character!='a')

{

found=true;

break;

}

}

}

// This gives the character 'a'

int ascii = (int) character;

ascii-=1;

str = str.substring(0, i) + (char)ascii+ str.substring(i + 1);

return str;

}

}

How we can earn from an app​

Answers

Answer:

Hewo, Here are some ways in which apps earn money :-

AdvertisementSubscriptionsIn-App purchasesMerchandisePhysical purchasesSponsorship

hope it helps!

SUMMING THE TRIPLES OF THE EVEN INTEGERS FROM 2 THROUGH 10) Starting with a list containing 1 through 10, use filter, map and sum to calculate the total of the triples of the even integers from 2 through 10. Reimplement your code with list comprehensions rather than filter and map.

Answers

Answer:

numbers=list(range(1,11)) #creating the list

even_numbers=list(filter(lambda x: x%2==0, numbers)) #filtering out the even numbers using filter()

triples=list(map(lambda x:x*3 ,even_numbers)) #calculating the triples of each even number using map

total_triples=sum(triples) #calculatting the sum

numbers=list(range(1,11)) #creating the list

even_numbers=[x for x in numbers if x%2==0] #filtering out the even numbers using list comprehension

triples=[x*3 for x in even_numbers] #calculating the triples of each even number using list comprehension

total_triples=sum(triples) #calculating the sum.

Explanation:

Go to the page where you are going to write the code, name the file as 1.py, and copy and paste the following code;

numbers=list(range(1,11)) #creating the list

even_numbers=list(filter(lambda x: x%2==0, numbers)) #filtering out the even numbers using filter()

triples=list(map(lambda x:x*3 ,even_numbers)) #calculating the triples of each even number using map

total_triples=sum(triples) #calculatting the sum

numbers=list(range(1,11)) #creating the list

even_numbers=[x for x in numbers if x%2==0] #filtering out the even numbers using list comprehension

triples=[x*3 for x in even_numbers] #calculating the triples of each even number using list comprehension

total_triples=sum(triples) #calculating the sum

D-H public key exchange Please calculate the key for both Alice and Bob.
Alice Public area Bob
Alice and Bob publicly agree to make
N = 50, P = 41
Alice chooses her Bob
picks his
Private # A = 19 private #
B= ?
------------------------------------------------------------------------------------------------------------------------------------------
I am on Alice site, I choose my private # A = 19.
You are on Bob site, you pick up the private B, B and N should have no common factor, except 1.
(Suggest to choose B as a prime #) Please calculate all the steps, and find the key made by Alice and Bob.
The ppt file of D-H cryptography is uploaded. You can follow the steps listed in the ppt file.
Show all steps.

Answers

Answer:

See explaination

Explanation:

Please kindly check attachment for the step by step solution of the given problem.

Which of the following is a component of slides

Answers

i need a picture to answer.

g Q 2 Suppose I need a data structure having the following characteristics: a) must be very space efficient, and b) I have a good idea of how much total data needs to be stored. b) must have fastest access possible, and c) once I add an item to the data structure, I do not remove it. Part 1: What data structure would I choose and why? (2,4) Part 2: If I remove characteristic b, what similar data structure is a possible candidate?

Answers

Explanation:

a.I would choose an advanced data structure like  dispersion tables.

Scatter tables, better known as hash tables, are one of the most frequently used data structures. To get an initial idea, scatter tables make it possible to have a structure that relates a key to a value, such as a dictionary. Internally, the scatter tables are an array. Each of the array positions can contain none, one or more dictionary entries.

It will normally contain a maximum of one, which allows quick access to the elements, avoiding a search in most cases. To know at which position in the array to search or insert a key, a scatter function is used. A scatter function relates each key to an integer value. Two equal keys must have the same dispersion value, also called a hash value, but two different keys can have the same dispersion value, which would cause a collision.

B. If I eliminated the characteristic b, a possible candidate keeping the previous characteristics would be: Balanced binary trees

Balanced binary trees are data structures that store key-data pairs, in an orderly way according to the keys, and allow quick access to the data, given a particular key, and to go through all the elements in order.

They are appropriate for large amounts of information and have less overhead than a scatter table, although the access time is of greater computational complexity.

Although the storage form has a tree structure internally, this is not externalized in the API, making the handling of the data transparent. They are called balanced because, each time they are modified, the branches are rebalanced in such a way that the height of the tree is as low as possible, thus shortening the average time of access to the data.

Given the following header: vector split(string target, string delimiter); implement the function split so that it returns a vector of the strings in target that are separated by the string delimiter. For example: split("10,20,30", ",") should return a vector with the strings "10", "20", and "30". Similarly, split("do re mi fa so la ti do", " ") should return a vector with the strings "do", "re","mi", "fa", "so", "la", "ti", and "do". Write a program that inputs two strings and calls your function to split the first target string by the second delimiter string and prints the resulting vector all on line line with elements separated by commas. A successful program should be as below with variable inputs:

Answers

Answer:

see explaination

Explanation:

#include <iostream>

#include <string>

#include <vector>

using namespace std;

vector<string> split(string, string);

int main()

{

vector<string> splitedStr;

string data;

string delimiter;

cout << "Enter string to split:" << endl;

getline(cin,data);

cout << "Enter delimiter string:" << endl;

getline(cin,delimiter);

splitedStr = split(data,delimiter);

cout << "\n";

cout << "The substrings are: ";

for(int i = 0; i < splitedStr.size(); i++)

cout << "\"" << splitedStr[i] << "\"" << ",";

cout << endl << endl;

cin >> data;

return 0;

}

vector<string> split(string target, string delimiter)

{

unsigned first = 0;

unsigned last;

vector<string> subStr;

while((last = target.find(delimiter, first)) != string::npos)

{

subStr.push_back(target.substr(first, last-first));

first = last + delimiter.length();

}

subStr.push_back(target.substr(first));

return subStr;

}

A user has called the company help desk to inform them that their Wi-Fi enabled mobile device has been stolen. A support ticket has been escalated to the appropriate team based on the corporate security policy. The security administrator has decided to pursue a device wipe based on corporate security policy. However, they are unable to wipe the device using the installed MDM solution. What is one reason that may cause this to happen?

Answers

Answer:

The software can't locate the device

Explanation:

The device wasn't properly setup in order for the software to locate it.

after turning the volume all the way up on the speakers you still can't hear any sound which of the following should be your the next step

Answers

Answer:

check if its pluged in

Explanation:

3.15 LAB: Countdown until matching digits
Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.

Ex: If the input is:

93
the output is:

93 92 91 90 89 88
Ex: If the input is:

77
the output is:

77
Ex: If the input is:

15
or any value not between 20 and 98 (inclusive), the output is:

Input must be 20-98.


#include

using namespace std;

int main() {

// variable

int num;



// read number

cin >> num;

while(num<20||num>98)

{

cout<<"Input must be 20-98 ";

cin>> num;

}



while(num % 10 != num /10)

{

// print numbers.

cout<
// update num.

num--;

}

// display the number.

cout<
return 0;

}




I keep getting Program generated too much output.
Output restricted to 50000 characters.

Check program for any unterminated loops generating output

Answers

Answer:

See explaination

Explanation:

n = int(input())

if 20 <= n <= 98:

while n % 11 != 0: // for all numbers in range (20-98) all the identical

digit numbers are divisible by 11,So all numbers that

​​​​​​ are not divisible by 11 are a part of count down, This

while loop stops when output digits get identical.

print(n, end=" ")

n = n - 1

print(n)

else:

print("Input must be 20-98")

Which term describes the order of arrangement of files and folders on a computer?
File is the order of arrangement of files and folders.

Answers

Answer:

Term describes the order of arrangement of files and folders on a computer would be ORGANIZATION.

:) Hope this helps!

Answer:

The term that describes the order of arrangement of files and folders on a computer is organization.

Explanation:

Write the method addItemToStock to add an item into the grocery stock array. The method will: • Insert the item with itemName add quantity items to stock. • If itemName is already present in stock, increase the quantity of the item, otherwise add new itemName to stock. • If itemName is not present in stock, insert at the first null position in the stock array. After the insertion all items are adjacent in the array (no null positions between two items). • Additionally, double the capacity of the stock array if itemName is a new item to be inserted and the stock is full.

Answers

Answer:

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

   //varible to indicate size of the array

   int size=20;

   //arrays to hold grocery item names and their quantities

   std::string grocery_item[size];

   int item_stock[size];

   //variables to hold user input

   std::string itemName;

   int quantity;

   //variable to check if item is already present

   bool itemPresent=false;

   //variable holding full stock value

   int full_stock=100;

   for(int n=0; n<size; n++)

   {

       grocery_item[n]="";

       item_stock[n]=0;

   }

   do

   {

       std::cout << endl<<"Enter the grocery item to be added(enter q to quit): ";

       cin>>itemName;

       if(itemName=="q")

       {

               cout<<"Program ends..."<<endl; break;

       }

       else

       {

           std::cout << "Enter the grocery item stock to be added: ";

           cin>>quantity;

       }

   for(int n=0; n<size; n++)

   {

       if(grocery_item[n]==itemName)

       {

           itemPresent=true;

           item_stock[n]=item_stock[n]+quantity;

       }

   }

   if(itemPresent==false)

   {

       for(int n=0; n<size; n++)

       {

           if(grocery_item[n]=="")

           {

               itemPresent=true;

               grocery_item[n]=itemName;

               item_stock[n]=item_stock[n]+quantity;

           }

       

           if(item_stock[n]==full_stock)

           {

               item_stock[n]=item_stock[n]*2;

           }

       }

   }

   }while(itemName!="q");

   return 0;

}

OUTPUT

Enter the grocery item to be added(enter q to quit): rice

Enter the grocery item stock to be added: 23

Enter the grocery item to be added(enter q to quit): bread

Enter the grocery item stock to be added: 10

Enter the grocery item to be added(enter q to quit): bread

Enter the grocery item stock to be added: 12

Enter the grocery item to be added(enter q to quit): q

Program ends...

Explanation:

1. The length of the array and the level of full stock has been defined inside the program.

2. Program can be tested for varying values of length of array and full stock level.

3. The variables are declared outside the do-while loop.

4. Inside do-while loop, user input is taken. The loop runs until user opts to quit the program.

5. Inside do-while loop, the logic for adding the item to the array and adding the quantity to the stock has been included. For loops have been used for arrays.

6. The program only takes user input for the item and the respective quantity to be added.

Rewrite this if/else if code segment into a switch statement int num = 0; int a = 10, b = 20, c = 20, d = 30, x = 40; if (num > 101 && num <= 105) { a += 1; } else if (num == 208) { b += 1; x = 8; } else if (num > 208 && num < 210) { c = c * 3; } else { d += 1004; }

Answers

Answer:

public class SwitchCase {

   public static void main(String[] args) {

       int num = 0;

       int a = 10, b = 20, c = 20, d = 30, x = 40;

       switch (num){

           case 102: a += 1;

           case 103: a += 1;

           case 104: a += 1;

           case 105: a += 1;

           break;

           case 208: b += 1; x = 8;

           break;

           case 209: c = c * 3;

           case 210: c = c * 3;

           break;

           default: d += 1004;

       }

   }

}

Explanation:

Given above is the equivalent code using Switch case in JavaThe switch case test multiple levels of conditions and can easily replace the uses of several if....elseif.....else statements.When using a switch, each condition is treated as a separate case followed by a full colon and the the statement to execute if the case is true.The default statement handles the final else when all the other coditions are false

(JAVA programming) Guess Number program

Program description: Write a program named GuessNumber that plays a game in which the program picks a secret number and the user tries to guess it.

1) The program first asks the user to enter the maximum value for the secret number.

2) Next, it chooses a random number that is >= 1 and<= the maximum number.

3) Then the user must try to guess the number.

4) When the user succeeds, the program asks the user whether or not to play another game.

The following example shows what the user will see on the screen (user input is in bold):

2. Input and output Guess the secret number.

Enter maximum value for secret number: 10

A new secret number has been chosen.

Enter guess: 3

Too low; try again. Enter guess: 8

Too low; try again. Enter guess: 9

Too low; try again. Enter guess: 10

You won in 4 guesses!

Play again? (Y/N) y

A new secret number has been chosen.

Enter guess: 7

Too high; try again.

Enter guess: 3

Too low; try again.

Enter guess: 5

You won in 3 guesses!

Play again? (Y/N) n

The user may enter any number of spaces before and after each input. The program should terminate if the user enters any input other than y or Y when asked whether to play again. Hints 1) Use two while statement (nested) for the whole program.

2) Use the following statement to pick the secret number: int secretNumber = (int) (Math.random() * maxNumber) + 1; 3) Use trim() method to trim any number of spaces in an input. 4) Use the equalsIgnoreCase method to test whether the user entered y or Y.

Answers

Answer:

The following are the program in the Java Programming Language.

import java.util.Random; //import package

import java.util.Scanner; //import package

//define a class

public class GuessNumber {

   //define a main method

   public static void main(String[] args)

   {

       //create object of the Scanner class

       Scanner cs = new Scanner(System.in);

       //print message

       System.out.println("Guess the secret number\n");

       //print message

       System.out.print("Enter the maximum value for the secret number: ");

       //get input in the integer variable through scanner class object

       int maxNum=cs.nextInt();

       //create object of the Random class

       Random ran = new Random();

       //declare an integer variable that store random number  

       int guessed = 1+ran.nextInt(maxNum);

       //set the while loop

       while (true)  

       {

           //print message

           System.out.println("\nA new secret number has been chosen.");

           //set two integer variables to 0

           int user = 0;

           int count = 0;

           //set the while loop

           while (user != guessed)  

           {

               //print message

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

               //get input in the variable from user

               user = cs.nextInt();

               //increment the variable by 1

               count++;

               //check that the user is less than guessed

               if (user < guessed)  

               {

                   //then, print message

                   System.out.println("low, try again.");

               }

               //check that user is greater than guessed

               else if (user > guessed)  

               {

                   //then, print message

                   System.out.println("high, try again");

               }

           }

           //print message with count

           System.out.println("You won in " + count + "!");

           //print message and get input

           System.out.print("\nPlay again? (Y/N)");

           cs.nextLine();

           String again = cs.nextLine();

           //check that input is y

           if(again.equalsIgnoreCase("y"))

           {

               //then, loop again iterates

               continue;

           }

           //otherwise, loop is break

           else{

               break;

           }

       }

   }

}

Explanation:

The following are the description of the program :

Firstly, we import the required packages and define the class 'GuessNumber'. Inside the class, we create the object of the scanner class and the random class then, get input from the user through scanner class object and generate random number through the random class object. Then, set the while infinite loop in which we declare two integer data type variables and assign them to 0 then, set while loop inside the infinite loop that iterates when the 1st variable is not equal to the second one then, get input from the user through scanner class object. Then, check that input number is less than the random number then, print message otherwise, again check that input number is greater than the random number then, print message or if both numbers are equal then print the message with the count. Finally, the program asks for play again, if the input is 'y' then, infinite loop again iterates otherwise the infinite loop is break.

The java program to compile the numbers gotten from the user request is:

import java.util.Scanner; //import packagepublic class GuessNumber {   public static void main(String[] args)   {       Scanner cs = new Scanner(System.in);       System.out.println("Guess the secret number\n");       System.out.print("Enter the maximum value for the secret number: ");       int maxNum=cs.nextInt();       Random ran = new Random();       //declare an integer variable that store random number         int guessed = 1+ran.nextInt(maxNum);       //set the while loop       while (true)         {           //print message           System.out.println("\nA new secret number has been chosen.");           //set two integer variables to 0           int user = 0;           int count = 0;           //set the while loop           while (user != guessed)             {               //print message               System.out.print("Enter guess: ");               //get input in the variable from user               user = cs.nextInt();               //increment the variable by 1               count++;               //check that the user is less than guessed               if (user < guessed)                 {                   //then, print message                   System.out.println("low, try again.");               }               //check that user is greater than guessed               else if (user > guessed)                 {                   //then, print message                   System.out.println("high, try again");               }           }           //print message with coun           System.out.println("You won in " + count + "!");           //print message and get input           System.out.print("\nPlay again? (Y/N)");           cs.nextLine();           String again = cs.nextLine();           //check that input is y           if(again.equalsIgnoreCase("y"))           {               //then, loop again iterates               continue;           }           //otherwise, loop is break           else{               break;           }       }   }}

Read more about java programming here:

https://brainly.com/question/18554491

This represents a group of Book values as a list (named books). We can then dig through this list for useful information and calculations by calling the methods we're going to implement. class Library: Define the Library class. • def __init__(self): Library constructor. Create the only instance variable, a list named books, and initialize it to an empty list. This means that we can only create an empty Library and then add items to it later on.

Answers

Answer:

class Library:      def __init__(self):        self.books = [] lib1 = Library()lib1.books.append("Biology") lib1.books.append("Python Programming Cookbook")

Explanation:

The solution code is written in Python 3.

Firstly, we can create a Library class with one constructor (Line 2). This constructor won't take any input parameter value. There is only one instance variable, books, in the class (Line 3). This instance variable is an empty list.

To test our class, we can create an object lib1 (Line 5).  Next use that object to add the book item to the books list in the object (Line 6-8).  

Suppose you are given a text file. Design a Python3 program to encrypt/decrypt that text file as follows:
If the character is an upper case character then shift that character forward, s characters forward in the alphabet.
If the character is a lower case character then shift that character backwards, s characters backwards in the alphabet.
If the character is a numeric character then shift that character also backwards, s characters backwards in the 1-digit numbers set {0,1,2,3,4,5,6,7,8,9}.
You must design two functions; one to encrypt. The other one is to decrypt. All white space and punctuation marks must be ignored(cannot be changed). If you reach Z, or A, the shifting may continue as a cycle(A comes after Z, Z comes before A). Both files (original text file and the encrypted text file) must be stored in the working directory of Python.
An example;
Let s=1 and the text file:
11300Hello World
Then encoded text file;
002991dkkn Xnqke

Answers

Answer:

Explanation:

Please find attachment for the Python program

5.14 ◆ Write a version of the inner product procedure described in Problem 5.13 that uses 6 × 1 loop unrolling. For x86-64, our measurements of the unrolled version give a CPE of 1.07 for integer data but still 3.01 for both floating-point data. A. Explain why any (scalar) version of an inner product procedure running on an Intel Core i7 Haswell processor cannot achieve a CPE less than 1.00. B. Explain why the performance for floating-point data did not improve with loop unrolling.

Answers

Answer:

(a) the number of times the value is performs is up to four cycles. and as such the integer i is executed up to 5 times.  (b)The point version of the floating point can have CPE of 3.00, even when the multiplication operation required is either 4 or 5 clock.

Explanation:

Solution

The two floating point versions can have CPEs of 3.00, even though the multiplication operation demands either 4 or 5 clock cycles by the latency suggests the total number of clock cycles needed to work the actual operation, while issues time to specify the minimum number of cycles between operations.

Now,

sum = sum + udata[i] * vdata[i]

in this case, the value of i performs from 0 to 3.

Thus,

The value of sum is denoted as,

sum = ((((sum + udata[0] * vdata[0])+(udata[1] * vdata[1]))+( udata[2] * vdata[2]))+(udata[3] * vdata[3]))

Thus,

(A)The number of times the value is executed is up to 4 cycle. And the integer i performed up to 5 times.

Thus,

(B) The floating point version can have CPE of 3.00, even though the multiplication operation required either 4 or 5 clock.

Write a program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores in (1) original order, (2) sorted from high to low (3) the highest score, (4) the lowest score, and (5) the average of the scores. Implement the following functions using the given function prototypes: void displayArray(int array[], int size) - Displays the content of the array void selectionSort(int array[], int size) - sorts the array using the selection sort algorithm in descending order. Hint: refer to example 8-5 in the textbook. int findMax(int array[], int size) - finds and returns the highest element of the array int findMin(int array[], int size) - finds and returns the lowest element of the array double findAvg(int array[], int size) - finds and returns the average of the elements of the array

Answers

Answer: Provided in the explanation segment

Explanation:

Below is the code to carry out this program;

/* C++ program helps prompts user to enter the size of the array. To display the array elements, sorts the data from highest to lowest, print the lowest, highest and average value. */

//main.cpp

//include header files

#include<iostream>

#include<iomanip>

using namespace std;

//function prototypes

void displayArray(int arr[], int size);

void selectionSort(int arr[], int size);

int findMax(int arr[], int size);

int findMin(int arr[], int size);

double findAvg(int arr[], int size) ;

//main function

int main()

{

  const int max=50;

  int size;

  int data[max];

  cout<<"Enter # of scores :";

  //Read size

  cin>>size;

  /*Read user data values from user*/

  for(int index=0;index<size;index++)

  {

      cout<<"Score ["<<(index+1)<<"]: ";

      cin>>data[index];

  }

  cout<<"(1) original order"<<endl;

  displayArray(data,size);

  cout<<"(2) sorted from high to low"<<endl;

  selectionSort(data,size);

  displayArray(data,size);

  cout<<"(3) Highest score : ";

  cout<<findMax(data,size)<<endl;

  cout<<"(4) Lowest score : ";

  cout<<findMin(data,size)<<endl;

  cout<<"(5) Lowest scoreAverage score : ";

  cout<<findAvg(data,size)<<endl;

  //pause program on console output

  system("pause");

  return 0;

}

 

/*Function findAvg that takes array and size and returns the average of the array.*/

double findAvg(int arr[], int size)

{

  double total=0;

  for(int index=0;index<size;index++)

  {

      total=total+arr[index];

  }

  return total/size;

}

/*Function that sorts the array from high to low order*/

void selectionSort(int arr[], int size)

{

  int n = size;

  for (int i = 0; i < n-1; i++)

  {

      int minIndex = i;

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

          if (arr[j] > arr[minIndex])

              minIndex = j;

      int temp = arr[minIndex];

      arr[minIndex] = arr[i];

      arr[i] = temp;

  }

}

/*Function that display the array values */

void displayArray(int arr[], int size)

{

  for(int index=0;index<size;index++)

  {

      cout<<setw(4)<<arr[index];

  }

  cout<<endl;

}

/*Function that finds the maximum array elements */

int findMax(int arr[], int size)

{

  int max=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]>max)

          max=arr[index];

  return max;

}

/*Function that finds the minimum array elements */

int findMin(int arr[], int size)

{

  int min=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]<min)

          min=arr[index];

  return min;

}

cheers i hope this help!!!

Let A be an array of n numbers. Recall that a pair of indices i, j is said to be under an inversion if A[i] > A[j] and i < j. Design a divide-and-conquer based algorithm to count the number of inversions in an array of n numbers. You can start by splitting into two subproblems. Answer clearly how you do the merge step, then obtain a recurrence relation that captures the run time of the algorithm. Solve the recurrence relation. Write the complete pseudocode.

Answers

Answer:

Check the explanation

Explanation:

#include <stdio.h>

int inversions(int a[], int low, int high)

{

int mid= (high+low)/2;

if(low>=high)return 0 ;

else

{

int l= inversions(a,low,mid);

int r=inversions(a,mid+1,high);

int total= 0 ;

for(int i = low;i<=mid;i++)

{

for(int j=mid+1;j<=high;j++)

if(a[i]>a[j])total++;

}

return total+ l+r ;

}

}

int main() {

int a[]={5,4,3,2,1};

printf("%d",inversions(a,0,4));

  return 0;

}

Check the output in the below attached image.

Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices of all pairs of values in the list that sum up to n. If there are no pairs that sum up to n, the function should not print anything. Note that the function does not duplicate pairs of indices

Answers

Answer:

Following are the code to this question:

def pairSum(a,x): #find size of list

   s=len(a) # use length function to calculte length of list and store in s variable

   for x1 in range(0, s):  #outer loop to count all list value

       for x2 in range(x1+1, s):    #inner loop

           if a[x1] + a[x2] == x:    #condition check

               print(x1," ",x2) #print value of loop x1 and x2  

pairSum([12,7,8,6,1,13],13) #calling pairSum method

Output:

0   4

1   3

Explanation:

Description of the above python can be described as follows:

In the above code, a method pairSum is declared, which accepts two-parameter, which is "a and x". Inside the method "s" variable is declared that uses the "len" method, which stores the length of "a" in the "s" variable. In the next line, two for loop is declared, in the first loop, it counts all variable position, inside the loop another loop is used that calculates the next value and inside a condition is defined, that matches list and x variable value. if the condition is true it will print loop value.

3. Write a project named Money that prompts for and reads a double value representing a monetary amount. Then determine the fewest number of each bill and coin needed to represent that amount, starting with the highest (assume that a ten-dollar bill is the maximum size need). For example, if the value entered is 47.63 (forty-seven dollars and sixty-three cents), then the program should print the equivalent amount as:

Answers

Answer: Provided in the explanation segment

Explanation:

The following code provides answers to the given problem.

import java.util.*;

public class untitled{

public static void main(String[] args)

{int tens,fives,ones,quarters,dimes,nickles,pennies,amt;

double amount;

Scanner in = new Scanner(System.in);

System.out.println("What do you need to find the change for?");

amount=in.nextDouble();

System.out.println("Your change is");

amt=(int)(amount*100);

tens=amt/1000;

amt%=1000;

fives=amt/500;

amt%=500;

ones=amt/100;

amt%=100;

quarters=amt/25;

amt%=25;

dimes=amt/10;

amt%=10;

nickles=amt/5;

pennies=amt%5;

System.out.println(tens +" ten dollar bills");

System.out.println(fives +" five dollar bills");

System.out.println(ones +" one dollar bills");

System.out.println(quarters +" quarters");

System.out.println(dimes +" dimes");

System.out.println(nickles +" nickles");

System.out.println(pennies +" pennies");

}

}

cheers i hope this helped !!

Consider the following relations:
Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer) Dept(did: integer, budget: integer, floor: integer, mgr_eid: integer) Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about five employees on average, there are 10 floors, and budgets vary from $10,000 to $1 million. You can assume uniform distributions of values. For each of the following queries, which of the listed index choices would you choose to speed up the query.
1. Query: Print ename, age, and sal for all employees.
A) Clustered hash index on fields of Emp.
B) Unclustered hash index on fields of Emp.
C) Clustered B+ tree index on fields of Emp.
D) Unclustered hash index on fields of Emp.
E) No index.
2. Query: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000.
A) Clustered hash index on the floor field of Dept.
B) Unclustered hash index on the floor field of Dept.
C) Clustered B+ tree index on fields of Dept.
D) Clustered B+ tree index on the budget field of Dept.
E) No index.

Answers

Answer:

Check the explanation

Explanation:

--Query 1)

SELECT ename, sal, age

FROM Emp;

--Query 2)

SELECT did

FROM Dept

WHERE floot = 10 AND budget<15000;

Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output parameters xValNew and yValNew. The function returns void. The transformation is new = (old + 1) * 2. Ex: If xVal = 3 and yVal = 4, then xValNew is 8 and yValNew is 10.

Answers

Answer:

Check the explanation

Explanation:

#include <iostream>

using namespace std;

void CoordTransform(int x, int y, int& xValNew,int& yValNew){

  xValNew = (x+1)*2;

  yValNew = (y+1)*2;

}

int main() {

  int xValNew = 0;

  int yValNew = 0;

  CoordTransform(3, 4, xValNew, yValNew);

  cout << "(3, 4) becomes " << "(" << xValNew << ", " << yValNew << ")" << endl;

  return 0;

}

Write Scheme functions to do the following. You are only allowed to use the functions introduced in our lecture notes and the helper functions written by yourself. (a) Return all rotations of a given list. For example, (rotate ’(a b c d e)) should return ((a b c d e) (b c d e a) (c d e a b) (d e a b c) (e a b c d)) (in some order). (b) Return a list containing all elements of a given list that satisfy a given predicate. For example, (filter (lambda (x) (< x 5)) ’(3 9 5 8 2 4 7)) should return (3 2 4).

Answers

Answer:

Check the explanation

Explanation:

solution a:

def Rotate(string) :

n = len(string)

temp = string + string

for i in range(n) :

for j in range(n) :

print(temp[i + j], end = "")

print()

string = ("abcde")

Rotate(string)

solution b:

nums = [3,9,5,8,2,4,7]

res = list(filter(lambda n : n < 5, nums))

print(res)

Define a thread that will use a TCP connection socket to serve a client Behavior of the thread: it will receive a string from the client and convert it to an uppercase string; the thread should exit after it finishes serving all the requests of a client Create a listening TCP socket While (true) { Wait for the connection from a client Create a new thread that will use the newly created TCP connection socket to serve the client Start the new thread. }

Answers

Answer:

The primary intention of writing this article is to give you an overview of how we can entertain multiple client requests to a server in parallel. For example, you are going to create a TCP/IP server which can receive multiple client requests at the same time and entertain each client request in parallel so that no client will have to wait for server time. Normally, you will get lots of examples of TCP/IP servers and client examples online which are not capable of processing multiple client requests in parallel.  

Explanation:

hope i helped

Other Questions
A wedge of cheese in the shape of a triangular prism is shown below.Find the surface area of the cheese._______Square feet Two angles are supplementary. The measure of the larger angle is 12 degrees more than three times the smaller angle. Find the measures of the angles 7. Why did the United States become involved in the Korean War?to free Korea from occupation by Japanto stop the North Korean invasion of South Koreato prevent the Soviet Union from taking over Korea to protect oil reserves found on the Korean Peninsula The pretax financial income (or loss) figures for Whispering Company are as follows. 2015 $164,000 2016 275,000 2017 86,000 2018 (164,000 ) 2019 (390,000 ) 2020 113,000 2021 98,000 Pretax financial income (or loss) and taxable income (loss) were the same for all years involved. Assume a 25% tax rate for 2015 and 2016 and a 20% tax rate for the remaining years. Prepare the journal entries for the years 2017 to 2021 to record income tax expense and the effects of the net operating loss carryforwards. All income and losses relate to normal operations. (In recording the benefits of a loss carryforward, assume that no valuation account is deemed necessary.) From the moment the first car started how many hours will it take the second car to catch up to the first Whish is An essay offering an opinion about a novel?A. InterpretationB. Literary analysisC. EvaluationD. Literary Review A bike tire has a diameter of 16 inches What is the radius of the bike What is the circumference of the bike Please help ASAP! Will give BRAINLIEST! Please read the question THEN answer correctly! No guessing. Three point charges are positioned on the x axis. If the charges and corresponding positions are +32 C at x = 0, +20 C at x = 40 cm, and 60 C at x = 60 cm, what is the magnitude of the electrostatic force on the +32-C charge? * what is the distance between (2,6) and (5,10)? Seventy-five percent of the flowers in the arrangement are roses and the rest are tulips. Of the tulips, 50 percent are pink. To the nearest whole percent, what is the probability that a randomly chosen flower from the arrangement is a pink tulip? Subraya la opcin cuya serie de palabras tiene el mismo significado. A) viejo, remoto, antiguo, arcaico, aejo b) aumentar, incrementar, disminuir, crecer, ampliar c) defender, atacar, proteger, cuidar, resguardar How do you convert kilometers to grams Model 4 + (-6) on the number line.-4-5-6--10-9-83- 21--7047125369810 Why should extra precautions against sun exposure be taken when boating? Water cancels out most sunscreens. UV rays are blocked over land, but not over water. The heat of the water increases potential skin damage. The water reflects UV rays, adding to exposure. Would a piece of wood with a mass of 48 grams and a volume of 47.4 cm^3 float in water? Clasifica las siguientes oraciones en yuxtapuestas, coordinadas osubordinadas (7 puntos)Sal de casa; tom el autobs; me dirig a la oficina.Tom el autobs, pero no me dirig a la oficina.Hay una foto en la cual esa modelo se ve muy bien.El reloj que me regalaron, se ve muy bien.Jams estudiaba de noche ni estudiaba de da ni estudiaba de tarde.Ir si me invitan.No salga usted a la calle; llueve torrencialmente. the diagram shows three steps in the clotting process.Which lists the clotting process in the proper order?o , , , , o , , , , Please answer this I will give brainliest thank you very much for your help What is a monument? Whats the purpose?