Questions
Create an application that allows you to enter student data than consists of an ID number,...

Create an application that allows you to enter student data than consists of an ID number, first name, last name, and grade point average. If the student's GPA is less than 2.0, write the record to an academic probation file, otherwise, write the record to a good standing file Once the student records are complete, read in the good standing file. If the GPA is greater than or equal to 3.5, display the students name for the Dean's List Be sure to include any exceptions needed for the program to run smoothly. Save the file as StudentsStanding.java I've figured out the first part in writing the files, but having trouble with reading in the files to make the Dean's List.

In: Computer Science

Done in C++ please. And use #include iostream, string, and fstream. do not use #include algorithm....

Done in C++ please. And use #include iostream, string, and fstream. do not use #include algorithm.

Question 1 In this question, you will read words from a file and place them into an array of type string.

1- Make a data text file “words.txt” – that contains one word on each line. Use at least 20 words.

2- Now write a program that reads the words in the file into an array of strings (a repeated word should not be inserted into the array – your program should not allow that and you should make sure your data file has duplicate words to test this functionality). Make your array size enough to hold 1000 words. To read the words into the array, you should make a function that takes a string array, a data size integer (dsize) by reference and an ifstream – please look at the example we did in class.

3- Declare your array and file streams in main and call the function that reads the data into the array.

4- Write a printArray function that takes a string array, the dsize and an ostream object so that you could print to the console or to an output file.

5- Print your array from main by calling the printArray function – once to the console and once to a file “wordsoutput.txt”.

6- Use the selectionSort Algorithm that we covered in class to sort the array.

7- Repeat #5 and make sure the array is sorted.

8- Find the maximum string and the minimum string in the array (remember arrays are compared based on the ASCII value).

9- Write a function that takes a string and converts every character of it to uppercase. Now call that function from a function that you pass the array and dsize to, to uppercase all words in the array (convert all words in the array to uppercase letter) and call that from main passing your array to that function. Print the array.

In: Computer Science

Kindly type the answer but don't copy and paste - 250 words Compare and contrast the...

Kindly type the answer but don't copy and paste - 250 words

Compare and contrast the Linear Classifier and Decision Tree Classifier

In: Computer Science

0. Introduction. This laboratory assignment involves designing a perfect hash function for a small set of...

0. Introduction.

This laboratory assignment involves designing a perfect hash function for a small set of strings. It demonstrates that a perfect hash function need not be hard to design, or hard to understand.

1. Theory.

We’ll start by reviewing some terminology from the lectures. A hash function is a function that takes a key as its argument, and returns an index into an array. The array is called a hash table. The object that appears at the index in that array is the key’s value.The key’s value is somehow associated with the key.
      A hash function may return the same index for two different keys. This is called a collision. Collisions are undesirable if we want distinct values to be associated with distinct keys. A hash function that has no collisions for a set of keys is said to be perfectfor that set. Note that a hash function may be perfect for some sets of keys, but not perfect for others.
      Most modern programming languages use a small set of reserved names as operators, punctuation, and syntactic markers. (They’re also called reserved words or keywords.) For example, Java currently uses reserved names like if, private, while, etc.
      A compiler for a programming language must be able to test if a name in a program is reserved. Programs may be hundreds or thousands of pages long, and may contain thousands or even millions of names. As a result, the test must be done efficiently. It might be implemented using a hash table and a perfect hash function.
      Here’s how the test may work. Suppose that the hash table T is an array of strings. Each time the compiler reads a name N, it calls a perfect hash function h to compute an index h(N). If h(N) is a legal index for T, and T[h(N)] = N, then the name is reserved, otherwise it is not. Unused elements of T might be empty strings "". If we measure the efficiency of a test by the number of string comparisons it performs, then the test requires only O(1) comparisons. Of course this works only if h is perfect for the set of reserved names.
      Now suppose there is a very simple programming language that uses the following set of twelve reserved names.

and

else    

or

begin

end

return

define  

if

then

do

not

while

We might define a perfect hash function for the reserved names in the following way. We get one or more characters from each name. Then we convert each character to an integer. This is easy, because characters are already represented as small nonnegative integers. For example, in the ASCII and Unicode character sets, the characters 'a' through 'z' are represented as the integers 97 through 122, without gaps. Finally, we do some arithmetic on the integers to obtain an index into the hash table. We choose the characters, and the arithmetic operations, so that no two reserved names result in the same index.
      For example, if we define the hash function h so that it adds the first and second characters of each name, we get the following indexes.

h("and")

  =  

207

h("begin")

  =  

199

h("define")

  =  

201

h("do")

  =  

211

h("else")

  =  

209

h("end")

  =  

211

h("if")

  =  

207

h("not")

  =  

221

h("or")

  =  

225

h("return")

  =  

215

h("then")

  =  

220

h("while")

  =  

223

This definition for h does not result in a perfect hash function, because it has collisions. For example, the strings "and" and "if" result in the index 207. Similarly, the strings "do" and "end" result in the index 211. We either didn’t choose the right characters from each string, or the right operations to perform on those characters, or both. Unfortunately, there is no good theory about how to define h. The best we can do is try various definitions, by trial and error, until we find one that is perfect.

2. Implementation.

Design a perfect hash function for the reserved names shown in the previous section. To do that, write a small test class, something like this, and run it with various definitions for the function hash. It calls hash for each reserved name, and writes indexes to standard output.

class Test  
{  
  private static final String [] reserved =  
   { "and",  
     "begin",  
     "define",  
     "do",  
     "else",  
     "end",  
     "if",  
     "not",  
     "or",  
     "return",  
     "then",  
     "while" };  
  
  private static int hash(String name)  
  {  
    //  Your code goes here.  
  }  
  
  public static void main(String [] args)  
  {  
    for (int index = 0; index < reserved.length ; index += 1)  
    {  
      System.out.print("h(\"" + reserved[index] + "\") = ");  
      System.out.print(hash(reserved[index]));  
      System.out.println();  
    }  
  }  
}

When defining hash, you might try adding characters at specific indexes from each name. You might try linear combinations of the characters: that is, multiplying the characters by small constants, then adding or subtracting the results. You might try the operator %. You might also try a mixture of these. Whatever you try, reject any definition of hash that is not perfect: one that returns the same index for two different names.
      Your method hash must work in constant time, without loops or recursions. It must not use if’s or switch’es. It must not call the Java method hashCode, because that uses a loop, and so does not work in O(1) time. It must not return negative integers, because they can’t be array indexes.
      The character at index k in name is obtained by name.charAt(k). Characters in Java Strings are indexed starting from 0, and ending with the length of the string minus 1. For example, the first character from name is returned by name.charAt(0), the second character by name.charAt(1), and the last character by name.charAt(name.length() - 1).
      Don’t worry if there are gaps between the indexes: your hash function need not be minimal. Also, try to keep the returned indexes small: they shouldn’t exceed 2000. For example, I know a perfect hash function for the reserved words in this assignment, whose indexes range from 1177 to 1413. I found it after about ten minutes of trial-and-error search.

In: Computer Science

A JavaFX question a method called generate2Num(Pane, pane){}; A botton "botton1" that botton.setOnAction(e-> {}); calling generate2Num...

A JavaFX question

a method called generate2Num(Pane, pane){};

A botton "botton1" that botton.setOnAction(e-> {}); calling generate2Num method and show the numbers on Scene.

Every time the user clicks botton1, the updated number will show on the Scene.

I just wanna know how can I update my data by click the button.

Please show the code , thank you

In: Computer Science

Write a program to sort the student’s names (ascending order), calculate students’ average test scores and...

Write a program to sort the student’s names (ascending order), calculate students’ average test scores and letter grades (Use the 10 point grading scale). In addition, count the number of students receiving a particular letter grade. You may assume the following input file data :


Johnson 85 83 77 91 76

Aniston 80 90 95 93 48

Cooper 78 81 11 90 48

Gupta 92 83 30 69 87

Muhammed 23 45 96 38 59

Clark 60 85 45 39 67

Patel 77 31 52 74 83

Abara 93 94 89 77 97

Abebe 79 85 28 93 82

Abioye 85 72 49 75 63

  1. (40%) Use four arrays: a one-dimensional array to store the students’ names, a (parallel) two dimensional array to store the test scores, a one-dimensional array to store the student’s average test scores and a one-dimensional array to store the student’s letter grades.

  2. (60%) Your program must contain at least the following functions :

    1. A function to read and store data into two arrays,

    2. A function to calculate the average test score and letter grade,

    3. A function to sort all the arrays by student name, and

    4. A function to output all the results (i.e. sorted list of students and their corresponding grades)  

    5. Have your program also output the count of the number of students receiving a particular letter grade.  

NOTE : No non-constant global variables are to be used. You can name the arrays and functions anything you like. You can use the operator >= to sort the strings.

In C++

In: Computer Science

The hexademical number system uses base 16 with digits 0, 1, 2, 3, 4, 5, 6,...

The hexademical number system uses base 16 with digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Hexadecimal is often used in computer systems programming. Write a Python program, in a file called convertHex.py, to request a decimal number from the user and output the hexadecimal value. To compute the hexadecimal value we have to find the hexadecimal digits hn, hn-1, hn-2, ..., h2, h1, and h0, such that

  d = hn x 16n + hn-1 x 16n-1 + hn-2 x 16n-2 + ... + h2 x 162 + h1 x 161 +  h0 x 160

These hexadecimal digits can be found by successively dividing d by 16 until the quotient is 0; the remainders are h0, h1, ..., hn-1, hn.

For example, if d=589:

  • 589/16 is 36 with a remainder of 13 - 13 in hexadecimal is 'D' - this is h0
  • 36/16 is 2 with a remainder of 4 - 4 in hexadecimal is '4' - this is h1
  • 2/16 is 0 with a remainder of 2 - 2 in hexadecimal is '2' - this is h2

So 589 in decimal is 24D in hexadecimal.

Your program should include the following functions:

  • decToHex(dec_value) - returns the hexadecimal equivalent of dec_value (as a string)
  • getHexChar(dec_digit) - returns the hexadecimal digit for dec_digit (note that 10 in decimal is 'A' in hex, 11 in decimal is 'B', etc)

Sample output:

Enter decimal value: 589
589 is equal to 24D in hexadecimal

In: Computer Science

WEEK 3 DISCUSSION# 4 ANSWER THE FOLLOWING : 1: Fully explain how to use one of...

WEEK 3 DISCUSSION# 4

ANSWER THE FOLLOWING :

1: Fully explain how to use one of the threat modeling tools

2: What are the benefits or issues with Microsoft’s Threat Modeling process and tool?

In: Computer Science

C++Design and implement a program (name it LinearBinarySearch) to implement and test the linear and binary...

C++Design and implement a program (name it LinearBinarySearch) to implement and test the linear and binary search algorithm discussed in the lecture slides. Define method LinearSearch() to implement linear search of an array of integers. Modify the algorithm implementation to count number of comparisons it takes to find a target value (if exist) in the array. Define method BinarySearch() to implement binary search of an array of integers. Modify the algorithm implementation to count number of comparisons it takes to find a target value (if exist) in the array. Now, develop a test method to read integer values from the user in to an array and then call methods LinearSearch() and BinarySearch() and printout the number of comparison took to find the target values using each search method. Document your code and organized your outputs as follows: Arrays Values: Target value: Linear Search Comparisons: Binary Search Comparisons:

In: Computer Science

Would it be useful to have an encryption that is additive and multiplicative in Homomorphic?

Would it be useful to have an encryption that is additive and multiplicative in Homomorphic?

In: Computer Science

We will use El Paso information for our python script to compute property taxes for a...

We will use El Paso information for our python script to compute property taxes for a home. We will default and use the Ysleta Independent School District tax rate for our school (more complete lookups will allow you to compute taxes based on exact address.) The taxing entities, and their respective tax rates per $100 is shown below:

Jurisdiction Total Rate ($) per $100

YSLETA ISD 1.3533

CITY OF EL PASO 0.907301

COUNTY OF EL PASO 0.488997

UNIVERSITY MEDICAL CENTER OF EL PASO 0.267747

EL PASO COMMUNITY COLLEGE 0.141167

Python Script Instructions: Create a loop that will allow the user to input a property value and calculate its related tax payment. Output property information as described below. The user will be asked to continue for another property or quit.

This will be a script broken into functions. It must include (may include more):

• Main function • Calculate property tax function

• Output information function called from Calculate function. Output will include the amount for each jurisdiction, and amount owed per year.

Other important information: We will assume each property value is eligible for a 10% Homestead Exemption of the property’s value. For example, if a property value is $100,000, the person would receive an exemption of $10,000. Their property taxes would be calculated on $90,000.

Don’t forget the rate is applied per $100 (i.e. you have to divide the amount for each jurisdiction you calculated by 100)

Sample calculation: Property value: $175,000 Yearly taxes owed: $4,974.66

In: Computer Science

Your friend wants to start an ecommerce website to commercialize some crafts she has been creating....

Your friend wants to start an ecommerce website to commercialize some crafts she has been creating. She has approached you for an explanation on the basics to start an ecommerce website.

Write a 1 - 2 page essay explaining to your friend what she needs to know to begin an e-commerce website. As part of your essay make sure you include:

• A definition of what ecommerce is.

• A definition of the Internet and the World Wide Web, and how they are used to facilitate ecommerce.

• Categories of ecommerce, and the category that your friend would beimplementing.

• How the key components of an eBusiness solution work (front end/ back end).

• The steps your friend would follow to set up an ecommerce website:

o Selecting an eCommerce business strategy

o Getting a domain name

o Developing a site (tools, design, services)

o Deciding whether to develop/host the site herself or seek an external host service provider (identify the pros/cons of each decision)

o Implementing a methodto collect payments

o Establishing basic management methods to mitigate typical security threats (describe some typical threats)

In: Computer Science

9.12) How do you write a PHP script that collects the data from the form provided...

9.12) How do you write a PHP script that collects the data from the form provided below and write it to a file?

.html
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Song Survey</title>
</head>
<body>
<form method="post" action="http://localhost/lab/lab 14.php"><br />
<h3>Enter The Date</h3>
<table>
<tr>
<td>Name Of The Song:</td>
<td><input type="text" name="SongName" size="30"></td>
</tr>
<tr>
<td>Name Of The Composer:</td>
<td><input type="text" name="CName"></td>
</tr>
<tr>
<td>Name Of The Singer:</td>
<td><input type="text" name="Singer"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>

.php
<html>
<head>
<title>Song Information</title>
</head>
<body>
<?php
$SName=$_POST["SongName"];
$CName=$_POST["CName"];
$Singer=$_POST["Singer"];
$song_file= 'song.txt';
$file_handle = fopen($song_file, 'a') or die('Cannot open file: '.$song_file);
fwrite($file_handle,$SName);
fwrite($file_handle,"#");
fwrite($file_handle,$Singer);
fwrite($file_handle,"##");
fwrite($file_handle,$CName);
fwrite($file_handle,"\r\n");
fclose($file_handle);
?>
<p>The Contents Are Written to the file <u>song.txt</u></p>
<?php
$file_handle = fopen("song.txt", "rb");
print "<h4>The Most Popular songs are.....</h4>";
while (!feof($file_handle))
{
$line_of_text = fgets($file_handle);
$parts = explode(' # ',$line_of_text);
print ("$parts[0]<br/>");
}
fclose($file_handle);
?>
</body>
</html>

In: Computer Science

C++ If I want to ask the user to input the variables in a vector, how...

C++
If I want to ask the user to input the variables in a vector, how can I do that?

I'm trying to implement this in a program with matrices. So the user should enter how many rows and columns they want, then enter the values

Can you help me out

In: Computer Science

in C++ Using your previous homework code: 1) Add a default constructor for the runners. (...

in C++

Using your previous homework code:

1) Add a default constructor for the runners. ( one that has no parameters)

2) Add a constructor that takes a name and a bib number

3) Add a constructor that takes a name , a bib number and a sex.

Add setter functions that sets the time:

1) one that takes a string of the format : hh:mm:ss

2) one that takes an int that is the number of seconds the runner took to complete the race.

Please Note: You decide what format inside the class to store the time amount.  

Add getter functions that return the time:

1) one that returns a string in the format : hh:mm:ss

2) one that returns an int that this the time in seconds.

Add a comment section to your class and explain why you chose some things.

1) What data type did you decide on in the class for the time, why

2) What was an alternative? Is your decision a big decision or a small decision? why

Please note : Again pick one C++ data type inside the class to store the time.

Do not use two variables to store the time.

Please note: if you write conversion functions that if expected. Do not make them public.  

Please note: on the time returned as a string please test and verify that times like these contain the correct zeros not blanks. the format will always be either: ( b = blank, hh = hours, mm = minutes, ss = seconds )

bh:mm:ss

hh:mm:ss

so a time like 1:03:02 will NOT be displayed as : 1:3:2. I strongly suggest testing in these areas.

You may want to convert from a string to an integer for you students here is some

sample code

String conversion using stoi() or atoi()
stoi() : The stoi() function takes a string as an argument and returns its value. Following is a simple implementation:

filter_none

edit

play_arrow

brightness_4

// C++ program to demonstrate working of stoi()

// Work only if compiler supports C++11 or above.

#include <iostream>

#include <string>

using namespace std;

  

int main()

{

    string str1 = "45";

    string str2 = "3.14159";

    string str3 = "31337 geek";

  

    int myint1 = stoi(str1);

    int myint2 = stoi(str2);

    int myint3 = stoi(str3);

  

    cout << "stoi(\"" << str1 << "\") is "

         << myint1 << '\n';

    cout << "stoi(\"" << str2 << "\") is "

         << myint2 << '\n';

    cout << "stoi(\"" << str3 << "\") is "

         << myint3 << '\n';

  

    return 0;

}

Output:

stoi("45") is 45
stoi("3.14159") is 3
stoi("31337 geek") is 31337 



Please Note:  
You may decide that you need a function that returns a 2 character long string 
given an integer.   This is starter code .   
It does not fully help you in this project you will need to modify or add 
a bit of stuff to get it to be truly helpful. the statement 
temp+=number%10+48;
could be coded as :
temp+=number%10+'0';

Here is some starter code:

string convertInt(int number)
{
    if (number == 0)
        return "0";
    string temp="";
    string returnvalue="";
    while (number>0)
    {
        temp+=number%10+48;
        number/=10;
    }
    for (int i=0;i<temp.length();i++)
        returnvalue+=temp[temp.length()-i-1];
    return returnvalue;
}

this is my code from my previous homework:

#include<iostream>

#include<string>

using namespace std;

class Runner

{

private:

string bibnumber;

char gender;

int age;

string name;

string time;

public:

Runner()

{

bibnumber=" ";

gender=' ';

age=0;

name=" ";

time=" ";

}

int getAge()

{

return age;

}

string getName()

{

return name;

}

string getTime()

{

return time;

}

string getBin()

{

return bibnumber;

}

char getGender()

{

return gender;

}

void setCombinedGenderBib ( string bib)

{

gender=bib[0];

bibnumber=bib.substr(1,bib.length());

}

void setName(string name)

{

this->name=name;

}

void setTime(string time)

{

this->time= time;

}

void setAge(int age)

{

this->age= age;

}

};

int main()

{

Runner runner;

runner.setName("john");

runner.setAge(23);

runner.setTime("01:04:37");

runner.setCombinedGenderBib("M4321");

cout<<"Name : "<<runner.getName()<<endl;

cout<<"Bin Number : "<<runner.getBin()<<endl;

cout<<"Age : "<<runner.getAge()<<endl;

cout<<"Gender : "<<runner.getGender()<<endl;

cout<<"Time : "<<runner.getTime()<<endl;

return0;

In: Computer Science