Questions
(C++) In a file called pp7c.cpp, write a function called printMoney that has one parameter, a...

(C++)
In a file called pp7c.cpp, write a function called printMoney that has one parameter, a double, and it prints this parameter out formatted like a dollar amount with $ and exactly 2 digits to the right of the decimal. Write a driver that declares an array of monetary amounts like this:
double amounts[MAX_AMOUNTS];
and uses a while or do while loop to ask the user for monetary amounts with -1 for the amount as a sentinel value to put values in the array, amounts. Do not allow the user to enter more than MAX_AMOUNTS numbers. This loop must count how many numbers are placed in the amounts array as the array may be partially filled. After using a do or do while loop to fill the array, write a for loop to call the printMoney function to print all of the values in the amounts array. The constant and function declarations are shown below.

                const int MAX_AMOUNTS = 10;

void printMoney( double m );

In: Computer Science

Perform SVM training and testing using SMS spam data set spam.csv . The objective is the...

Perform SVM training and testing using SMS spam data set spam.csv . The objective is the predict the class of a new SMS using SVM classifier. The data set is a collection of a set of SMS tagged messages that have been collected for SMS Spam research. It contains one set of SMS messages in English of 5,574 messages, tagged according being ham (legitimate) or spam. The files contain one message per line. Each line is composed by two columns: v1 contains the label (ham or spam) and v2 contains the raw text.

Data set: The details of learning and testing task is as follows:

1. Understand distribution of classes in the data set using suitable plots.

2. Plot distribution of frequent words under “spam" and “ham" classes.

3. Preprocess the data set if required.

4. Apply SVM classifier.

5. Use Cross validation and Hold-out approaches to learn and evaluate SVM classifier.

6. Discuss results achieved by SVM classifier using confusion matrix, sensitivity, specificity and accuracy.

Question 3 Consider a problem where we are given collection of reviews of a movie by 5 people. Each review is a sentence summarising the comments given by the person. The review is classified as either good or bad.

1. Create example supervised data set on this problem.

2. Formulate Naive Bayes classifier on this data set to predict a new review in defined category

[Hint:- Please refer to the given example Analyzing Textual Data with Natural Language Processing.pdf for solving question 2 & 3.]

In: Computer Science

Can you write code in Java to find the power set of a given set? For...

Can you write code in Java to find the power set of a given set? For example if S={a,b} the power set is P={{},{a},{b},{a,b}} ( you can also choose any of your favorite programming language). Explaning the code in comment please.

In: Computer Science

Write a python program that has: function createCustomerRecord that has 1 parameter, the filename to read...

Write a python program that has:

  1. function createCustomerRecord that has 1 parameter, the filename to read from, the method then reads all the records from the file and returns a dictionary. Each record in the file has the following format

CivilIdNumber

Name

Telephone#    

Address

CivilIdNumber

Name

Telephone#    

Address

CivilIdNumber

Name

Telephone#    

Address

Etc

A record always consists of 4 lines (civilid, name, telephone and address). You can find a sample input file on last page of this assignment, copy it and past it into a .txt file and save it to the same directory that your python program resides on.

The function then creates a dictionary with the civilIdNuber as the key and the rest of the record as a list with index 0 being the name, index 1 being the telephone# and index 2 being Address.

When finishing reading all records the function then returns the dictionary

  1. Write a function printCustomerRecord that has 2 parameters, a dictionary of the customer record and the output filename, the function will then print to the output file, the dictionary in the following format

CivilId: civilidnumber

Name: name

Address: address

Telephone Number: telephone

CivilId: civilidnumber

Name: name

Address: address

Telephone Number: telephone

Etc…

  1. Write a main function that will print to the screen ‘Hello’, then call function createCistomerRecord and pass it the input file name then call function printCustomerRecord and pass it the dictionary and the output file name. Then finally print to the screen ‘goodbye’

  1. Call the main function.

In: Computer Science

Code an application program that keeps tracks of srudent information at your college:names, identification numbers, and...

Code an application program that keeps tracks of srudent information at your college:names, identification numbers, and grade point averages in a fully encapsulated (homogenous) sorted array-based data structure. When launched, the user will be asked to input the maximum size of data set, the initial number of students, and the initial data set. once this is complete, the user will be presented with the following menu:
Enter:1 to insert a new student's info
2 to fetch and out put a student's info
3 to delete student info
4 to update student info
5 to output all the student info in sorted order
6 to exit program
note: please use Java language to create this program and please write comments for each statement that what is happening. i know there are same questions solution posted in chegg, but i want some unique from others

In: Computer Science

Problem 9 - PYTHON There is a CSV-formatted file called olympics2.csv. Write code that creates a...

Problem 9 - PYTHON

There is a CSV-formatted file called olympics2.csv. Write code that creates a dictionary named country_olympians where the keys are country names and the values are lists of unique olympians from that country (no olympian's name should appear more than once for a given country).

Name,Sex,Age,Team,Event,Medal
A Dijiang,M,24,China,Basketball,NA
A Lamusi,M,23,China,Judo,NA
Gunnar Nielsen Aaby,M,24,Denmark,Football,NA
Edgar Lindenau Aabye,M,34,Sweden,Tug-Of-War,Gold
Christine Jacoba Aaftink,F,21,Netherlands,Speed Skating,NA
Christine Jacoba Aaftink,F,21,Netherlands,Speed Skating,NA
Christine Jacoba Aaftink,F,25,Netherlands,Speed Skating,NA
Christine Jacoba Aaftink,F,25,Netherlands,Speed Skating,NA
Christine Jacoba Aaftink,F,27,Netherlands,Speed Skating,NA
Christine Jacoba Aaftink,F,27,Netherlands,Speed Skating,NA
Per Knut Aaland,M,31,United States,Cross Country Skiing,NA
Per Knut Aaland,M,31,United States,Cross Country Skiing,NA
Per Knut Aaland,M,31,United States,Cross Country Skiing,NA
Per Knut Aaland,M,31,United States,Cross Country Skiing,NA
Per Knut Aaland,M,33,United States,Cross Country Skiing,NA
Per Knut Aaland,M,33,United States,Cross Country Skiing,NA
Per Knut Aaland,M,33,United States,Cross Country Skiing,NA
Per Knut Aaland,M,33,United States,Cross Country Skiing,NA
John Aalberg,M,31,United States,Cross Country Skiing,NA
John Aalberg,M,31,United States,Cross Country Skiing,NA
John Aalberg,M,31,United States,Cross Country Skiing,NA
John Aalberg,M,31,United States,Cross Country Skiing,NA
John Aalberg,M,33,United States,Cross Country Skiing,NA
John Aalberg,M,33,United States,Cross Country Skiing,NA
John Aalberg,M,33,United States,Cross Country Skiing,NA
John Aalberg,M,33,United States,Cross Country Skiing,NA
"Cornelia ""Cor"" Aalten (-Strannood)",F,18,Netherlands,Athletics,NA
"Cornelia ""Cor"" Aalten (-Strannood)",F,18,Netherlands,Athletics,NA
Antti Sami Aalto,M,26,Finland,Ice Hockey,NA
"Einar Ferdinand ""Einari"" Aalto",M,26,Finland,Swimming,NA
Jorma Ilmari Aalto,M,22,Finland,Cross Country Skiing,NA
Jyri Tapani Aalto,M,31,Finland,Badminton,NA
Minna Maarit Aalto,F,30,Finland,Sailing,NA
Minna Maarit Aalto,F,34,Finland,Sailing,NA
Pirjo Hannele Aalto (Mattila-),F,32,Finland,Biathlon,NA
Arvo Ossian Aaltonen,M,22,Finland,Swimming,NA
Arvo Ossian Aaltonen,M,22,Finland,Swimming,NA
Arvo Ossian Aaltonen,M,30,Finland,Swimming,Bronze
Arvo Ossian Aaltonen,M,30,Finland,Swimming,Bronze
Arvo Ossian Aaltonen,M,34,Finland,Swimming,NA
Juhamatti Tapio Aaltonen,M,28,Finland,Ice Hockey,Bronze
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,Bronze
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,Gold
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,Gold
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,28,Finland,Gymnastics,Gold
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,Bronze
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Paavo Johannes Aaltonen,M,32,Finland,Gymnastics,NA
Timo Antero Aaltonen,M,31,Finland,Athletics,NA
Win Valdemar Aaltonen,M,54,Finland,Art Competitions,NA

In: Computer Science

Henry Magruder made a mistake—he left a CD at the coffee station. Later, when Iris Majwubu...

Henry Magruder made a mistake—he left a CD at the coffee station. Later, when Iris Majwubu was topping off her mug with fresh tea, hoping to wrap up her work on the current SQL code module before it was time to go home, she saw the unlabeled CD on the counter. Being the helpful sort, she picked it up, intending to return it to the person who’d left it behind.

Expecting to find perhaps the latest device drivers, or someone’s work from the development team’s office, Iris slipped the disk into the drive of her computer and ran a virus scan on its contents before opening the file explorer program. She had been correct in assuming the CD contained data files, and lots of them. She opened a file at random: names, addresses, and Social Security numbers appeared on her screen. These were not the test records she expected; they looked more like critical payroll data. Concerned, she found a readme.txt file
and opened it. It read:

Jill, see files on this disc. Hope they meet your expectations. Wire money to account as arranged. Rest of data sent on payment.

Iris realized that someone was selling sensitive company data to an outside information
broker. She looked back at the directory listing and saw that the files spanned the range of every department at Sequential Label and Supply—everything from customer lists to shipping invoices. She saw one file that appeared to contain the credit card numbers of every Web customer the company supplied. She opened another file and saw that it only contained about half of the relevant data. Whoever did this had split the data into two parts.

That made sense: payment on delivery of the first half. Now, who did this belong to? She opened up the file properties option on the readme.txt file. The file owner was listed as “hmagruder.” That must be Henry Magruder, the developer two cubes over in the next aisle. Iris pondered her next action.

Iris called the company security hotline. The hotline was an anonymous way to report any
suspicious activity or abuse of company policy, although Iris chose to identify herself. The
next morning, she was called to a meeting with an investigator from corporate security,
which led to more meetings with others in corporate security, and then finally a meeting with
the director of human resources and Gladys Williams, the CIO of SLS.

Questions:
1. Why was Iris justified in determining who the owner of the CD was?
2. Should Iris have approached Henry directly, or was the hotline the most effective way
to take action? Why do you think so?
3. Should Iris have placed the CD back at the coffee station and forgotten the whole
thing? Explain why that action would have been ethical or unethical.

In: Computer Science

PYTHON LANGUAGE Write the data in variable artist_songs into a csv file, 'songs.txt', where the first...

PYTHON LANGUAGE

Write the data in variable artist_songs into a csv file, 'songs.txt', where the first column is singer name and second column is a song name. Each line should have a singer and a song name. Use "Name" and "Song" as headers. Do not include double quotation marks (") in your CSV but you should include apostrophes where necessary (for example, for the song "We Don't Talk Anymore").

In [110]:

artist_songs = {
    'Taylor Swift': ['Love Story', 'You need to Calm Down'],
    'Charlie Puth': ['Attention', "We Don't Talk Anymore", 'Change']
}

In: Computer Science

Write a C program that selects and displays the maximum value of five numbers to be...

Write a C program that selects and displays the maximum value of five numbers to be entered when the program is executed. (Hint : Use a for loop with both a scan_s and if statement inside the loop.)

In: Computer Science

Please use the search engine (Such as google and baidu) to visit four different websites about...

Please use the search engine (Such as google and baidu) to visit four different websites about hotels or scenic spots, describe the features of these sites and multimedia elements.

In: Computer Science

If the items in a list are floats taking 8 memory locations each, compare the amount...

If the items in a list are floats taking 8 memory locations each, compare the amount of space required altogether if (a) the list is kept contiguously in an array 80 percent full (b) the list is kept contiguously in an array 60 percent full and (c) the list is kept as a linked list where the pointers take two memory locations each

In: Computer Science

(Java) Create a program using 3 methods. The methods must be public and static. Ask the...

(Java) Create a program using 3 methods. The methods must be public and static. Ask the user for 3 numbers, then call the methods from main to print max, min, and average.

The first method max (int x, int y, int z) returns the maximum value of 3 integer values.

The second method min (int X, int y, int z) returns the minimum value of 3 integer values.

And the third average (int x, int y, int z) returns the average of 3 integer values.

Sample Output: (bold = user input)

Enter # 1: 5

Enter # 2: 9

Enter # 3: 2

Min is 2

Max is 9

Average is 5.33333

Sample output 2

Enter # 1: 45

Enter # 2: 11

Enter # 3: -3

Min is -3

Max is 45

Average is 17.6667

Code Example:

int addTwoNumbers (int x, int y) {

int result = x + y;

return result;

In: Computer Science

The question: Write a program in Python that writes four random integers in range 1-100 on...

The question: Write a program in Python that writes four random integers in range 1-100 on a file named 'num.txt'. Write try-except block to handle at least two standard python error (any two errors).

Hints:

import random

def main():
    # Local variables

    # Open output file.

    # Write random numbers to the file.

    # Write it on to the file. 

    # Close the file.
    

# Call the main function.
main()

Here is my answer: please let me know if anything is wrong with it. thanks

"

import random

# define the min and max of the random numbers
min = 1
max = 100

def main():


#get four random numbers from 1 to 100 or min to max
number1 = random.randint(min,max)
number2 = random.randint(min,max)
number3 = random.randint(min,max)
number4 = random.randint(min,max)
  
#write TRY/EXCEPT statment
try:

#OPEN a file named num.txt
outfile = open('num.txt', 'w')
  
#WRITE the random numbers to the file
outfile.write(str(number1) + '\n')
outfile.write(str(number2) + '\n')
outfile.write(str(number3) + '\n')
outfile.write(str(number4) + '\n')
  
#PRINT the numbers
print(number1)
print(number2)
print(number3)
print(number4)

  

#write TRY/EXCEPT statment
except ValueError as err:
print(err)

except IOError:
print("An error occured trying to read the file.")


except KeyboardInterrupt:
print("Something went wrong when writing to the file.")
  
except:
print("An error occured.")

finally:
outfile.close()


#call the function
main()


"

In: Computer Science

Use a python code to solve Use Newton interpolation to find the unique polynomial p2(x) of...

Use a python code to solve

Use Newton interpolation to find the unique polynomial p2(x) of degree 2 or less, that agrees with the following data: p2(0) = 1, p2(2) = 5, p2(4) = 17.

In: Computer Science

Create a new Java project, name it “Quiz02”. (This is a JAVA Programming question, thumbs up...

Create a new Java project, name it “Quiz02”. (This is a JAVA Programming question, thumbs up quick and correct answer)

1) Create a java class Traveler that has four data members, String name, Date bDate, int id and int noOfDependens.

Generate the following:

1- Getters and Setters.

2- Four parametrize constructor to initialize the four data members above.

3- toString() method.

Create a java class Flight that has four data members, String number, String destination, int capacity, and ArrayList travelers.

 Note1 - travelers will be used to track the No. of travelers so far on the selected flight.

 Note2 - No. of travelers = No. of dependents + 1;

Generate the following: 1- Getters and Setters.

2- Three parametrize constructor to initialize the number, destination and capacity.

3- toString() method.

4- Method public void addTraveler(Traveler traveler) that will do the following:

a. It will calculate the total No. of travelers so far.

b. It will calculate the total availability = capacity - No. of travelers.

c. If the availability is equal to OR more than the requested tickets (traveler + his noOfDependens) then, accept this reservation and add the traveler to the flight ArrayList, otherwise, reject the reservation by printing the following message “This reservation is NOT accepted. Total No. of requested tickets are: X while the availability is: Y”

d. Sample for your output in case the reservation is accepted is listed below.

Create a java class AppSystem for testing, and include the main method. Then create the following:

Traveler("Traveler1", (17, 5, 1950), 1950517 , 7); Traveler("Traveler2", (2, 12, 1975), 1975122 , 5); Traveler("Traveler3", (13, 3, 1981), 1981313 , 3); Traveler("Traveler4", (9, 10, 1979), 1979109 , 4); Traveler("Traveler5", (25, 5, 1963), 1963525 , 6);    Flight("QAR246", "Kuwait", 70); Flight("Kuw579", "Doha", 60);

5- Add to the Flight QAR246 the first Traveler1 Sample for addTraveler() method after accepting the traveler Traveler1.

Flight capacity: 70

No. of current travelers: 0

Flight availability: 70

=======================================

Accepted reservation. Total No. of reserved tickets are: 8

6- Print the flight QAR246 details by calling the method toString(), sample for your method output listed below:

***** Flight details *****

==========================

Flight No.: QAR246

Flight destination: Kuwait

Flight Capacity: 70

List of travelers:

Traveler name: Traveler1

Birth Date: 17/ 5/1950

ID: 1950517

No. of Dependents: 7

In: Computer Science