Questions
1.what will be most responsible for gains in performance of microporcessors in the future? 2. what...

1.what will be most responsible for gains in performance of microporcessors in the future?
2. what peeiod of time (roughly give a decade) in associated with the first generation of computers?

In: Computer Science

in c++ please follow instructions and fix the errors and please make a comment next to...

in c++ please follow instructions and fix the errors and please make a comment next to each code error you fix.

  • Below are 25 code fragments, inserted into a try catch block.
  • Each line has zero or more errors. Your task is to find and remove all errors in each fragment.
    • Do not fix problems by simply deleting a statement; repair the problems by changing, adding, or deleting a few characters.
    • There may be different ways to fix them
    • You may need to rename variables to avoid re-declaration errors
    • When you fix a line, it should print out "Success!" and then a newline.
  • You may want to comment out each line that you have not fixed yet in order to get it to compile, so you can test as you go
  • In the end you should see a total of 25 "Success!" outputs

#include "std_lib_facilities.h"
int main()
try
{
//1.
Cout << "Success!\n";
//2.
cout << "Success!\n;
//3.
cout << "Success" << !\n"
//4.
cout << success << '\n';
//5.
string res = 7; vector<int> v(10); v[5] = res; cout << "Success!\n";
//6.
vector<int> v(10); v(5) = 7; if (v(5)!=7) cout << "Success!\n";
//7.
if (cond) cout << "Success!\n"; else cout << "Fail!\n";
//8.
bool c = false; if (c) cout << "Success!\n"; else cout << "Fail!\n";
//9.
string s = "ape"; boo c = "fool"<s; if (c) cout << "Success!\n";
//10.
string s = "ape"; if (s=="fool") cout << "Success!\n";
//11.
string s = "ape"; if (s=="fool") cout < "Success!\n";
//12.
string s = "ape"; if (s+"fool") cout < "Success!\n";
//13.
vector<char> v(5); for (int i=0; 0<v.size(); ++i) ; cout << "Success!\n";
//14.
vector<char> v(5); for (int i=0; i<=v.size(); ++i) ; cout << "Success!\n";
//15.
string s = "Success!\n"; for (int i=0; i<6; ++i) cout << s[i];
//16.
if (true) then cout << "Success!\n"; else cout << "Fail!\n";
//17.
int x = 2000; char c = x; if (c==2000) cout << "Success!\n";
//18.
string s = "Success!\n"; for (int i=0; i<10; ++i) cout << s[i];
//19.
vector v(5); for (int i=0; i<=v.size(); ++i) ; cout << "Success!\n";
//20.
int i=0; int j = 9; while (i<10) ++j; if (j<i) cout << "Success!\n";
//21.
int x = 2; double d = 5/(x–2); if (d==2*x+0.5) cout << "Success!\n";
//22.
string<char> s = "Success!\n"; for (int i=0; i<=10; ++i) cout << s[i];
//23.
int i=0; while (i<10) ++j; if (j<i) cout << "Success!\n";
//24.
int x = 4; double d = 5/(x–2); if (d=2*x+0.5) cout << "Success!\n";
//25.
cin << "Success!\n";


keep_window_open();
return 0;
}
catch (exception& e)
{
cerr << "error: " << e.what() << '\n';
keep_window_open();
return 1;
}
catch (...)
{
cerr << "Oops: unknown exception!\n";
keep_window_open();
return 2;
}

In: Computer Science

Java programming language should be used Implement a class called Voter. This class includes the following:...

  • Java programming language should be used

  • Implement a class called Voter. This class includes the following:

    • a name field, of type String.

    • An id field, of type integer.

    • A method String setName(String) that stores its input into the name attribute, and returns the

      name that was just assigned.

    • A method int setID(int) that stores its input into the id attribute, and returns the id number

      that was just assigned.

    • A method String getName() that return the name attribute.

    • A method int getID() that returns the id attribute.

    • A constructor method that takes no inputs, and then sets the name attribute to none and the

      id attribute to -1.

    • A constructor method that takes both an integer and a string, in that order. The integer is

      stored in the id attribute, and the string gets stored in the name attribute.

  • Implement a Voters class (notice the ‘s’ at the end of the class name).

    • In terms of attributes, this class will simply have a HashSet of Voter inside.

    • As methods, implement the following:

      • ▪ boolean addVoter(Voter), which adds the input Voter to the set and returns true, if the voter doesn’t exist in the set already. If the voter does exist in the set, the method returns false. Two objects of type Voter are equal if they have the same ID.

      • ▪ boolean deleteVoter(int), which deletes the Voter from the set that has the passed integer as its ID, and returns true, if the voter exist in the set. If the voter does not exist in the set, the method returns false.

▪ boolean isASubsetOf(Voters), which returns true if the Voters for which it is called is a subset of the Voters it receives as input. Otherwise, it returns false.

  • Instantiate two objects of class Voters
    ▪ an object called registeredVoters.
    ▪ An object called votersWhoHaveCastBallots

  • You should test your code with a main program. In that main program you should do the following:

    • ▪ add different voters to the registeredVoters object.

    • ▪ Try to add a voter to the registeredVoters that already exists. You should get an error

      message.

    • ▪ Try to delete a voter from the registeredVoters that doesn’t exists. You should get an

      error message.

    • ▪ Try to delete a voter from the registeredVoters that does exists. You should get a

      message confirming that the operation was carried out.

    • ▪ Add a voter to votersWhoHaveCastBallots who is not in registeredVoters. Check to see

      if the HashSet inside votersWhoHaveCastBallots is a subset of the HashSet inside registeredVoters. This should cause your program to display an error message notifying of this fact, and display the voter object that caused the problem.

◦ Next, run the deleteVoter method on votersWho HaveCastBallots until it is a subset of registeredVoters. Check to see if votersWhoHaveCastBallots is a subset

of registeredVoters. This should cause your program to display a message notifying of this fact, and displaying the elements of votersWhoHaveCastBallots which cause this error message.

In: Computer Science

Unix: Compare a sure kill with a regular kill command. When should you use a sure...

Unix: Compare a sure kill with a regular kill command. When should you use a sure kill?

In: Computer Science

Javascript 1. Write a function which receives four arguments (array, start, end, delimiter). Copy the array...

Javascript

1. Write a function which receives four arguments (array, start, end, delimiter). Copy the array values from the start to end index separated by delimiter\'s value. function([1,2,3,4],1,3,'*') // returns 2*3*4 as string

2. Write a function to change the case of all the characters in string based on their position which matches the value of the pos parameter passed to function(str, pos [even|odd]). Example: function(‘abCd’, ‘odd’) // returns Abcd

3 Write a function which receives two arguments (array, oddOrEven) based on the value of oddOrEven (odd or even value) the function will return the sum of all the array elements that matches the type of oddOrEven value. function([1,1,2,3,4],11) // returns 5 (which is the sum of all odd numbers)

DO NOT USE THESE BUILT IN FUNCTIONS BELOW

endsWith() includes() indexOf() lastIndexOf() localeCompare() match() repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() valueOf() trimLeft and trimRight unshift() valueOf()

includes() indexOf() lastIndexOf() localeCompare() match() repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() valueOf() trimLeft and trimRight unshift() valueOf()   
concat() copyWithin() every() fill() filter() find() findIndex() forEach() indexOf() isArray() join() lastIndexOf() map() pop() push() reduce() reduceRight() reverse() shift() slice() some() sort() splice() toString()

In: Computer Science

You will create a number of threads—for example, 100—and each thread will request a pid, sleep...

You will create a number of threads—for example, 100—and each thread will request a pid, sleep for a random period of time, and then release the pid. (Sleeping for a random period of time approximates the typical pid usage in which a pid is assigned to a new process, the process executes and then terminates, and the pid is released on the process's termination.) On UNIX and Linux systems, sleeping is accomplished through the sleep() function, which is passed an integer value representing the number of seconds to sleep.

Write the program in C .

In: Computer Science

The following code is included for the java programming problem: public class Bunny {        private...

The following code is included for the java programming problem:

public class Bunny {

       private int bunnyNum;

       public Bunny(int i) {

              bunnyNum = i;

       }

       public void hop() {

              System.out.println("Bunny " + bunnyNum + " hops");

       }

}

  • Create an ArrayList <????> with Bunny as the generic type.
  • Use an index for-loop to build (use .add(….) ) the Bunny ArrayList. From the output below, you need to have 5.
  • Use an index for-loop to call each of the Bunny hop( ). You need to use .get(i) to call the hop( ) of each Bunny.
  • Write an enhanced for-loop to display the Bunny hops. You don’t need to use the .get(i) call.
  • Create an Iterator<Bunny> reference variable, and use it to iterate through the Bunny ArrayList with the .hasNext() and .next() to get to the hop().

Display the following output:

+++++++++++ hop in for-loop

Bunny 0 hops

Bunny 1 hops

Bunny 2 hops

Bunny 3 hops

Bunny 4 hops

----------- hop in Enhanced-loop

Bunny 0 hops

Bunny 1 hops

Bunny 2 hops

Bunny 3 hops

Bunny 4 hops

*********** hop in Iterator style

Bunny 0 hops

Bunny 1 hops

Bunny 2 hops

Bunny 3 hops

Bunny 4 hops

In: Computer Science

In the following class public class Single { private float unique; ... } Create constructor, setter...

In the following class

public class Single
{
private float unique;
...
}

Create constructor, setter and getter methods, and toString method.

Write a program that request a time interval in seconds and display it in hours, minutes, second format.

NEED THESE ASAP

In: Computer Science

Hello, I am very new to 64-bit ARM assembly and would like the code to this...

Hello, I am very new to 64-bit ARM assembly and would like the code to this following question:

The Fibonacci Sequence is a series of integers. The first two numbers in the sequence are both 1; after that, each number is the sum of the preceding two numbers.

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...

For example, 1+1=2, 1+2=3, 2+3=5, 3+5=8, etc.

The nth Fibonacci number is the nth number in this sequence, so for example fibonacci(1)=1, fibonacci(2)=1, fibonacci(3)=2, fibonacci(4)=3, etc. Do not use zero-based counting; fibonacci(4)is 3, not 5.

Your assignment is to write an ARM assembler code (Fibonacci.s) that prompts the user for the nth term of the fibonacci sequence. The program will then calculate the users selected nth fibonacci term and print it out.

The program should produce this input:

Enter the desired Fibonacci term: 6
The 6th Fibonacci number is: 8

Please include comments about what the functions do in the code, thank you so much! Additionally note, I am compiling this code on a raspberry pi 3. So any additional comments would be most helpful.

In: Computer Science

C programming: Assume you have the following spreadsheet as example.csv. This .csv file can have more...

C programming:

Assume you have the following spreadsheet as example.csv. This .csv file can have more than 1000 lines of data.

time latitude longitude depth mag
2020-10-19T23:28:33.400Z 61.342 -147.3997 12.3 1.6
2020-10-19T23:26:49.460Z 38.838501 -122.82684 1.54 0.57
2020-10-19T23:17:28.720Z 35.0501667 -117.6545 0.29 1.51
2020-10-19T22:47:44.770Z 38.187 -117.7385 10.8 1.5
2020-10-19T22:42:26.224Z 54.4198 -159.9943 18.7 2.9
2020-10-19T22:39:38.900Z 18.004 -66.761 14 2.87

Read the spreadsheet which is example.csv file in your new c program and then sort the above data by latitude in ascending order. Use bubble or insertion sort and time it. Please do not hard code anything, especially do not hard code .csv file.

In: Computer Science

2. Given the following sentences: 1. Jack owns Fiat 2. John owns Opel. 3. Fiat is...

2. Given the following sentences:

1. Jack owns Fiat

2. John owns Opel.

3. Fiat is a car and Opel is a car too.

4. Every car owner can drive

5. Jack exceeds the speed limit

6. John fasten seat belt.

7. Every driver who exceeds the speed limit or does not fasten seat belt breaks traffic rules.

8. Every one who can drive is a driver

9. Everyone who breaks any traffic rules will get a fine

10. Bad drivers get fines.

11. Good drivers do not get fines.

a. Translate these sentences into predicate logic

b. Convert the above sentence represented in predicate logic into Horn Clauses

c. Write the horn clauses into Prolog syntax on any Prolog system available online like SWI Prolog.

d. Prove that Jack is a bad driver and John is a good driver by submitting each of the two previous predicate as goals to your knowledgebase. If the KB failed to infer any of these goals, explain why it failed and what predicate should be there to prove your goals.

In: Computer Science

if an 8-bit sar adc is used to digitize 8v full scale signal, what will be...

if an 8-bit sar adc is used to digitize 8v full scale signal, what will be the digital o/p for an analog i/p of 5.76 v

In: Computer Science

Question 3: (40 marks) You are requested to design an algorithm to check whether a key...

Question 3:

You are requested to design an algorithm to check whether a key pair (sum of two numbers only) exist in a given array (of size N) or not. If the key pair exists at least once then the algorithm should return “True”; otherwise “False”.

For example, given an array A[8, -3, 9, 5, -3, 11, 2, -7, 4, 11] where the key pair is 13, then the required algorithm should return “True” because such pair exist at least once ex:(9+4). Another example, given the same array, where the key pair is 21, the required algorithm should return “false”, as there is no any pair with sum equal to 21

  1. Another algorithm would first sort the array to take advantage of the sorted value to facilitate the search for the required key pair :  
    1. Design this algorithm [Hint: don't design a sorting function, simply use Sort(A) to do the job of sorting without going into the sorting details].
    2. In order to get a better performance, which sorting algorithm “Sort(A)” would you choose to do this task?

iii. What is the complexity of this algorithm in the best and worst case? (5 marks

In: Computer Science

Text Wrap Problem Write a program in Python that takes an input string and prints it...

Text Wrap Problem

Write a program in Python that takes an input string and prints it as multiple lines of text such that no line of text is greater than 13 characters and words are kept whole.

For example, the first line of the Gettysburg address:
Four score and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal

Becomes:

Four score

and seven

years ago our

fathers

broughtforth

upon

this

continent a

new nation,

conceived in

liberty and

dedicated to

the

proposition

that all men

are created

equal

In: Computer Science

This is for java For my assignment, I was supposed to make a number guessing game....

This is for java

For my assignment, I was supposed to make a number guessing game. The class, HiLo, should pick a random number between 1 and 100 (inclusive). Then, prompt the user to guess the number. On each guess, print if the user is correct or if the guess is too high or too low. Allow only 5 guesses. In the end, print out the correct answer and how many attempts were made.

Then give the user the option to play again (1 for yes and 0 for no).

I have tried to do this but I get stuck on making it so that there are only 5 guesses and I always get an error when asking the option to play again.

In: Computer Science