Python Assignment Help

Python Assignment Help

PYTHON

Create a folder that identifies you and Assignment 2 such as smith_asst2 or asst2_jones. Save all Python programs to this folder. Zip the folder. No .rar files allowed. Upload the zip to the Assignment 2 drop box.

 

1.    Alphabetic Telephone Number Translator

 

 

Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember.  On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion.

A, B and C = 2

D, E, and F = 3

G, H, and I = 4

J, K, and L = 5

M, N, and O= 6

P, Q, R, and S = 7

T, U, and V = 8

W, X, Y, and Z = 9

Write a program that asks the user to enter a 10-character telephone number in the format xxx-xxx-xxxx. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enter 555-GET-FOOD the application should display 555-438-3663

 

 

1.     Word separator

Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by space and only the first word starts with an uppercase letter. For example the string “ StopAndSmellTherRoses.” Would be converted to “Stop and smell the roses.”

 

2.    Pig Latin

Write a program that accepts a sentence as input and converts each word to “Pig Latin.” In one version, to convert a word to Pig Latin you remove the first letter and place that letter at the end of the word. Then you append the string ”ay” to the word. Here is an example:

 

English:      I SLEPT MOST OF THE NIGHT

Pig Latin:   IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

SQL Server 2012 Chapter 7 Assingment

SQL Server 2012 Chapter 7 Assingment

its due this saturday! feb 26th. sql server management studio needed to verify the code works! see attached document

 

 

1.      Write an INSERT statement that adds this row to the Categories table:

 

CategoryName:            Brass

 

Code the INSERT statement so SQL Server automatically generates the value for the CategoryID column.

 

2.      Write an UPDATE statement that modifies the row you just added to the Categories table. This statement should change the CategoryName column to “Woodwinds”, and it should use the CategoryID column to identify the row.

 

3.      Write a DELETE statement that deletes the row you added to the Categories table in exercise 1. This statement should use the CategoryID column to identify the row.

 

4.      Write an INSERT statement that adds this row to the Products table:

 

ProductID:                   The next automatically generated ID
CategoryID:                 4
ProductCode:               dgx_640
ProductName:              Yamaha DGX 640 88-Key Digital Piano
Description:                 Long description to come.
ListPrice:                      799.99
DiscountPercent:          0
DateAdded:                 Today’s date/time.

 

Use a column list for this statement.

 

5.      Write an UPDATE statement that modifies the product you added in exercise 4. This statement should change the DiscountPercent column from 0% to 35%.

 

6.      Write a DELETE statement that deletes the row in the Categories table that has an ID of 4. When you execute this statement, it will produce an error since the category has related rows in the Products table. To fix that, precede the DELETE statement with another DELETE statement that deletes all products in this category.

 

7.      Write an INSERT statement that adds this row to the Customers table:

 

EmailAddress:             rick@raven.com
Password:                    (empty string)
FirstName:                   Rick
LastName:                   Raven

 

Use a column list for this statement.

 

8.      Write an UPDATE statement that modifies the Customers table. Change the password column to “secret” for the customer with an email address of rick@raven.com.

 

9.      Write an UPDATE statement that modifies the Customers table. Change the password column to “reset” for every customer in the table.

 

10.  <<You don’t need to show this in your homework, but you should do it.>> Open the script named CreateMyGuitarShop.sql that’s in the Exercise Starts directory. Then, run this script. That should restore the data that’s in the database.

 

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Computer Course (Powerpoint) assignment Help 

Computer Course (Powerpoint) assignment Help

I have attached the four pictures that you are to make into a powerpoint presentation.  It is supposed to be four powerpoint slides.

Directions:

Grading Rubric: Point Values

PowerPoint Lab 1: Bobby’s Bake Shop

15 – Retrospect document theme applied; variant not changed

10 – Title slide created and formatted correctly

10 – Illustration called Bakery inserted, resized, and positioned

5 – The words Anytown, USA replaced with students’ hometown city and state

10 – Slide 2 uses Title Only slide layout; title added and formatted; picture called Doughnut inserted and positioned; pictured called Muffin inserted and positioned

10 – Slide 3 uses the Picture with Caption layout; picture inserted; text added and formatted

10 – Closing slide created based on the title slide and modified

15 – Clock transition in the Exciting category is applied to all slides and the duration is 2 seconds

10 – File is saved as “Lab 1-1 Bake”

5 – Spelling checked, typos corrected

Bake Shoppe: Creating a Presentation with Pictures – Grade

Assignment: Complete PPT52-53 PowerPoint Module 1 Lab 1: Bake Shoppe: Creating a Presentation with Pictures – Grade

Steps: 1-10

Introduction: PowerPoint Module 1 to get an understanding of how to use the software properly. You do not want to attempt to recreate the assignment without using the proper skills described in the module. Feel free to complete the module assignment to learn the proper steps or you can use the module as a reference.

The Assignment: Use MS Office 2016 to complete this assignment. MS Office 2016 is provided to each student. Click the MS Office 2016 Button in the Blackboard Menu to download the software. Do not use a mobile, online, or tablet version of the software as it will not have all of the options necessary to complete the assignment properly. Follow the steps in the assignment and save the file to a location of your choice when complete.

Data File(s): To use data files right click and “save target as” or “save link as”. Select the location to save. This will save the file to your computer so you can ope it and use it.  Do not click and open the file to try to use the file.  Bakery.png

(opens in new window) Bread.jpg (opens in new window)Doughnut.png (opens in new window)Muffin.png (opens in new window)

Grading Rubric:  PowerPoint Lab 1-1 Bake_Shop_Rubric.docx

(opens in new window)

To Submit:  Click the assignment title link. Click “Browse My Computer” Button below. Find your File. Attach your file.  Submit.

The Preview: Blackboard is not a Microsoft Software therefore the preview may not be an exact view of your original document. Only use the preview to ensure the file is the proper file but do not view it for accuracy. When your instructor grades the file will get downloaded and viewed in the created software for accuracy.

Check Your Submission: To check your submission, click the “My Grades” button in the Blackboard Menu.  Find the title of the assignment.  You should see a Yellow !.  Click the Assignment Name.  It is a link for you to view your submission.

Clear Your Submission: Assignments can be submitted only one time. If you submitted the incorrect file email your instructor and request to have the link cleared.

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Computer Science homework help

Computer Science homework help

Exp19_Word_Ch03_CAP_Boston

Word Chapter 3 Capstone – Boston (PC

 

Start Word. Download and open the file named Exp19_Word_Ch03_CAP_Boston.docx. Grader has automatically added your last name to the beginning of the filename.

Display nonprinting characters. With the insertion point at the beginning of the document, press ENTER. Return to the beginning of the document and insert a 3×2 table. Type Boston Travels in the first cell on the first row.

In the first cell of the second row, insert Boston1.png. Change the picture height to 1”. In the second cell of the second row, insert Boston2.png. Change the picture height to 1”. In the third cell of the second row, insert Boston3.png and resize it to 1”.

Click the Table Move handle to select the table. AutoFit table contents. Merge all cells on the first row, and apply Align Center alignment to the row. Change the font size of text in row 1 to 22 pt.

Cell margins provide space between a cell’s inside edges and the beginning of cell contents. By reducing cell margins, you remove some of the extra space so that cell contents are more nearly aligned at the edge of a cell. Because pictures are in this table’s cells, a neater arrangement is shown when there is very little space between them.

Apply a table style of Grid Table 4 – Accent 2 (row 4, column 3 under Grid Tables). Center the table horizontally on the page. Reduce left and right cell margins to 0”.

Click the Table Move handle to select the table. Select a border style of Double solid lines, ½ pt., Orange Accent 2 (sixth column, first row under Theme Colors). Apply the border to outside borders.

By converting existing text to a table, you are able to use table design and layout tools, resulting in an attractive and well-designed feature.

Press ENTER after the last body paragraph (ending in fantastic pricing). Select text at the end of the document, from Back Bay/Fenway to 16.00. Whether you select the paragraph mark following 16.00 is irrelevant. Convert the text to a table, accepting all dialog box settings.

Insert a column before the first column in the second table. Type Family Fun Tours in the first cell of the new column. Select the first three cells in the new column and merge them. Type Patriot Tours in the second cell of the first column (below the merged area). Select the second, third, and fourth cells in the first column and merge them. Type JFK/Harvard Tours in the third cell of the first column (below the Patriot Tours merged cell). Select the last three cells in the first column and merge them.

Select the third column. Click Split Cells and deselect Merge cells before split. Accept all other dialog box settings. Change the width of the second column to 2”. Change the width of the last two columns to 0.85”.

Insert a row above the first row. Type Tour Package in the first cell of the new row. Type Attraction in the second cell on the same row. Type Discounted Admission in the third cell on the same row.

Merge the last two cells on row 1. Apply Align Center alignment to row 1. Create a formula in the last cell on row 2 that subtracts (0.4*admission price) from the admission price. The admission price is shown in cell c2, so the formula should be =c2-(0.4*c2). The Number format should be #,##0.00. Adjusting for each row, enter a discounted admission formula for each attraction in the table.

Apply a table style of List Table 4 – Accent 2 (row 4, column 3 under List Tables). Center the table horizontally on the page. Apply Align Center alignment to all cells in column 1.

Changing font color is one way to draw attention to an item of interest. In this case, you want readers to recognize the substantial discount, shown in red.

Select all numbers in the last column and change the font color to Red (second column in Standard colors). Change the price of the Freedom Trail/Statehouse Tour from 15.00 to 16.00. Update the formula field in the same row to reflect the new discount value. Check for any spelling or grammatical errors, correcting any that are identified. Ignore any clarity or conciseness concerns.

Begin a mail merge, choosing Letters and selecting Sponsors.xlsx as the data source. Data is located on Sheet1$ of the data source. Edit the recipient list to sort by Sponsor in ascending order.

Replace [Sponsor] on the last line of the document with the merge field of Sponsor. Ensure that the brackets are included in the text to be replaced. Preview results and then finish the merge, editing individual documents and merging all. Press CTRL+A to select all of the merged document and copy the selection. Display Exp19_Word_Ch03_CAP_Boston, move the insertion point to the end of the document (after the Sponsor name) and insert a page break. Paste all copied text, resulting in a 9-page document

Save and close  Exp19_Word_Ch03_CAP_Boston. Close all other open documents without saving. Submit Exp_Word_Ch03_CAP_Boston.docx as directed.

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Computer Science homework help

Computer Science homework help

PART I:

 

For drawings, you may use your word-processing drawing tools, graphic applications, or scanned hand drawings and insert them in the main document.  Show all of your work.

 

1.         Chapter 4 – Exercises, pages 185-187: 2(a); 4(a-g); 6(a); 8.

 

#2) (a) Suppose the main memory of the Pep/8 were completely filled with unary instructions. How many instructions would it contain?

 

 

#4) Answer the following questions for the machine language instructions 8B00AC and F70BD3.

 

(a) What is the opcode in binary?

(b) What does the instruction do?

(c) What is the register-r field in binary?

(d) Which register does it specify?

(e) What is the addressing-aaa field in binary?

(f) Which addressing mode does it specify?

(g) What is the operand specifier in hexadecimal?

 

 

#6) Suppose Pep/8 contains the following four hexadecimal values:

 

A: 19AC

X: FE20

Mem[0A3F]: FF00

Mem[0A41]: 103D

 

If it has these values before each of the following statements executes, what are the four hexadecimal values after each statement executes?

 

(a) C90A3F

 

 

#8) Determine the output of the following Pep/8 machine-language program if the input is tab. The left column is the memory address of the first byte on the line:

 

0000    490010

0003     490011

0006    490012

0009    510011

000C   510010

000F    00

 

 

 

2.         Chapter 4 – Problems, page 187: 15.

 

#15) Write a machine-language program to add the three numbers 2, –3, and 6 and output the sum on the output device. Write it in a format suitable for the loader and execute it on the Pep/8 simulator.

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Training & Evading ML Based IDS (Python) homework help

CS6262-O01 Network Security – Project 5 Training & Evading ML based IDS

 

Introduction/Assignment Goal

The goal of this project is to introduce students to machine learning techniques and methodologies, that help to differentiate between malicious and legitimate network traffic. In summary, the students are introduced to:

· Use a machine learning based approach to create a model that learns normal network traffic.

· Learn how to blend attack traffic, so that it resembles normal network traffic, and by-pass the learned model.

NOTE: To work on this project, we recommend you to use Linux OS. However, in the past, students faced no difficulty while working on this project even on Windows or Macintosh OS.

 

Readings & Resources

This assignment relies on the following readings:

( • )“Anomalous Payload-based Worm Detection and Signature Generation”, Ke Wang, Gabriela Cretu, Salvatore J. Stolfo, RAID2004.

( • )“Polymorphic Blending Attacks”, Prahlad Fogla, Monirul Sharif, Roberto Perdisci, Oleg Kolesnikov, Wenke Lee, Usenix Security 2006.

· “True positive (true detections) and False positive (false alarms)”

 

Task A

( • )Preliminary reading. Please refer to the above readings to learn about how the PAYL model works: a) how to extract byte frequency from the data, b) how to train the model, and c) the definition of the parameters; threshold and smoothing factor. Note: Without this background it will be very hard to follow through the tasks.

( • )Code and data provided. Please look at the PAYL directory, where we provide the PAYL code and data to train the model.

· Install packages needed. Please read the file SETUP to install packages that are needed for the code to run.

· PAYL Code workflow. Here is the workflow of the provided PAYL code:

· It operates in two modes: a) training mode: It reads in pcap files provided in the ‘data’ directory, and it tests parameters and reports True Positive rates, and b) testing mode: It trains a model using specific parameters and using data in the directory, it will use a specific packet to test and then will decide if the packet fits the model.

· Training mode: It reads in the normal data and separates it into training and testing. 75% of the provided normal data is for training and 25% of the normal data is for testing. It sorts the payload strings by length and generates a model for each length. Each model per length is based on [ mean frequency of each ascii, standard deviation of frequencies for each ascii]

· To run PAYL on training mode: python wrapper.py. You will have to modify the port numbers in the

read pcap.py (commented in the sourcecode) according to the protocol you select.

· Testing mode: It reads in normal data from directory, it trains a model using specific parameters, and it tests the specific packet (fed from command line) against the trained model. 1. It computes the mahalanobis distance between each test payload and the model (of the same length), and 2. It labels the payload: If the mahalanobis distance is below the threshold, then it accept the payload as normal traffic. Otherwise, it reject the packet as attack traffic.

· To run PAYL on testing mode: python wrapper.py [FILE.pcap]

 

 

( #Sample Output: $ python wrapper.py Attack data not provided, training and testing model based on pcap files in data/ folder alone. )1

2

3

 

( 1 )

 

( To provide attack data, run the code as: python wrapper.py <attack-data-file-name> ——————————————— Training Testing Total Number of testing samples: 7616 Percentage of True positives: XX.XX Exiting now )4

5

6

7

8

9

10

 

Tasks:

( • )You are provided a single traffic trace (artificial-payload) to train a PAYL model.

( • )After reading the reference papers above, it should make sense that you cannot train the PAYL model on the entire traffic because it contains several protocols. Select a protocol: a) HTTP or b) IRC to train PAYL.

( • )Modify the IP addresses/port numbers (also commented in the python files) in the source code according to the traffic you choose (HTTP/IRC).

( • )Use the artificial traffic corresponding to the protocol that you have chosen and proceed to train PAYL. Use the provided code in the training mode and make sure that you are going to use the normal traffic(artificial payload) that is fed to your code while training. Provide a range of the two parameters (threshold and smoothing factor). For each pair of parameters you will observe a True Positive Rate. Select a pair of parameters that gives 95% or more True Positive; more than 99% true positive rate is possible. You may find multiple pairs of parameters that can achieve that.

 

Task B

( • )Download your unique attack payload: To download your unique attack payload, visit the following url: https://www.cc.gatech.edu/˜rgiri8/6262_P5/einstein7.pcap and replace “einstein7” with your GTID.

( • )Use PAYL in testing mode. Feed the same training data that you selected from Task A, use the same pair of parameters that you found from Task A and provide the attack trace.

· Verify that your attack trace gets rejected – in other words that it doesn’t doesn’t fit the model.

· You should run as follows and observe the following output:

( \$ python wrapper.py attack-trace-test.pcap Attack data provided, as command line argument attack-trace.pcap ——————————————— Training Testing Total Number of testing samples: 7616 Percentage of True positives: XX.XX ————————————– Analysing attack data, of length1 No, calculated distance of ZZZZ is greater than the threshold of XXXX. IT DOESN’T FIT THE MODEL. Total number of True Negatives: 100.0 Total number of False Positives: 0.0 \texttt{Number of samples with same length as attack payload: 1 )1

2

3

4

5

6

7

8

9

10

11

 

12

13

14

15

 

( • )Finally, use the artificial payload of the protocol you have selected. Test the artificial payload against your model (use testing mode as explained above). This packet should be accepted by your model. You should get an output that says “It fits the model”.

 

Task C

1. Preliminary reading. Please refer to the “Polymorphic Blending Attacks” paper. In particular, section 4.2 that describes how to evade 1-gram and the model implementation. More specifically we are focusing on the case where m <and the substitution is one-to-many.

2. We assume that the attacker has a specific payload (attack payload) that he would like to blend in with the normal

traffic. Also, we assume that the attacker has access to one packet (artificial profile payload) that is normal and is accepted as normal by the PAYL model.

 

3. The attackers goal is to transform the byte frequency of the attack traffic so that is matches the byte frequency of the normal traffic, and thus by-pass the PAYL model.

( • )Code provided: Please look at the Polymorphic blend directory. All files (including attack payload) for this task should be under this directory.

( • )How to run the code: Run task1.py. You will have to modify the port numbers according to the protocol you select in substitution.py (also commented in the sourcecode).

( • )Main function: task1.py contains all the functions that are called.

( • )Output: The code should generate a new payload that can successfully by-pass the PAYL model that you have found above (using your selected parameters). The new payload (output) is shellcode.bin + encrypted attack body + XOR table + padding. Please refer to the paper for full descriptions and definitions of Shellcode, attack body, XOR table and padding. The Shellcode is provided.

( • )Substitution table: We provide the skeleton for the code needed to generate a substitution table, based on the byte frequency of attack payload and artificial profile payload. According to the paper the substitution table has to be an array of length 256. For the purpose of implementation, the substitution table can be a python dictionary data structure. Since we are going to verify your substitution table, for the purpose of consistency, we ask you to use a dictionary data structure only(refer to appendix). You can use a list of values for a key in your substitution table. Your task is to complete the code for the substitution function. Also you are asked to implement the mapping as one-to-many.

( • )Padding: Similarly we have provided a skeleton for the padding function and we are asking you to complete the rest.

( • ) ( • )Main tasks: Please complete the code for the substitution.py and padding.py, to generate the new payload. Deliverables: Please deliver your code of the substitution, padding and the substitution table output (use print command to get it) along with the output of your code. Please see the deliverable section.

4. Test your output.

Test your output (below noted as output) against the PAYL model and verify that it is accepted. FP should be 100% indicating that the payload got accepted as legit, even though is malicious. You should run as follows and observe the following output:

 

( $ python wrapper.py Output Attack data provided, as command line argument Output ——————————————— Training Testing Total Number of testing samples: 7616 Percentage of True positives: XX.XX ————————————– Analysing attack data, of length1 Yes, calculated distance of YYYY is lesser than the threshold of XXXX. IT FITS THE MODEL. Total number of True Negatives: 0.0 Total number of False Positives: 100.0 )1

2

Deliverables & Rubric

( • )Task A: 35 points Please report the protocol that you used and the parameters that you found in a file named

parameters. Please report a decimal with 2 digit accuracy for each parameter.

Format:

( | | ) ( | | ) ( | | ) ( | | | | )Protocol:HTTP or Protocol:IRC Threshold:1.23 SmoothingFactor:1.24 TruePositiveRate:80.95

( • )Task B: 5 points Please append a new line in parameters with the score of the attack payload after completing Task B.

Format:

|Distance:2000|

· Task C: 60 points

–Code: 40 points. Please submit the code for substitution.py, substitution table.txt and

padding.py.

–Output: 20 points. Please submit your output of Task C generated as a new file after running task1.py.

 

A How to verify your task C:

If you only have 64-bit compiler, you need to run following:

( # Or whatever your current gcc version is sudo apt-get install lib32gcc-4.9-dev sudo apt-get install gcc-multilib )1

2

 

Next, then create a Makefile with following:

( a.out: shellcode.o payload.o gcc -g3 -m32 shellcode.o payload.o -o a.out shellcode.o: shellcode.S gcc -g3 -c shellcode.S -m32 -o shellcode.o payload.o: payload.bin objcopy -I binary -O elf32-i386 -B i386 payload.bin payload.o )1

2

3

4

5

6

 

Now, modify the hardcoded attack payload length at line no. 10 of shellcode.S with the length of your malicious at- tack payload. It should be an integer value equal to or the next multiple of 4 of your attack payload length. You can also get this number from task1.py and seeing what len(adjusted attack body) is. Without this the code wont point to the correct xor table location.

 

Next, you need to generate your payload. So, somewhere near the end of task1.py add the following to create your payload.bin:

( with open(“payload.bin”, “wb”) as payload_file: payload_file.write(’’.join(adjusted_attack_body + xor_table)) )1

2

 

Now, run task1.py to generate payload.bin and once it’s generated, run the makefile with make and then run a.out:

( make ./a.out )1

2

 

If all is well you should see your original packet contents. If not and you get a bunch of funny letters.. it didn’t work. Note: It was only tested on Linux, you might need to make a few modifications according to your system configuration.

 

A Sample substitution table.txt:

Below is the one-line output generated using “print substitution table” in python. Your substitution table.txt should look like this:

( {’t’: [(’Z’, 0.69), (’4’, 0.54), (’.’, 0.11), (’2’, 0.09), (’!’, 0.09), (’-’, 0.09), (’u ’, 0.07), (’x’, 0.07), (’9’, 0.05), (’v’, 0.05), (’,’, 0.04), (’k’, 0.04), (’)’, 0.009), (’(’, 0.008), (’5’, 0.008), (’F’, 0.007), (’&’, 0.0065), (’G’, 0.005), (’%’, 0.001), (’6’, 0.0001), (’B’, 0.0001), (’I’, 0.001), (’K’, 0.001), (’S’, 0.001), (’g’, 0.001), (’W’, 0.001)], ’.’: [(’s’, 0.041)], ’5’: [(’=’, 0.0225)], ’0’: [(’v’, 0.036) ], ’3’: [(’h’, 0.028)], ’1’: [(’\n’, 0.009)], ’9’: [(’”’, 0.025)], ’:’: [(“’”, 0.009) ], ’<’: [(’\’, 0.054)], ’F’: [(’m’, 0.029)], ’q’: [(’5’, 0.009)], ’b’: [(’c’, 0.04)], ’s’: [(’0’, 0.012)], ’u’: [(’b’, 0.0123)], ’o’: [(’>’, 0.035)], ’x’: [(’d’, 0.02)]} )1

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Computer Science: Application Multiple Choice

Computer Science: Application Multiple Choice

1. Which of these is a valid Java Karel command?

move;
move();
move()
move(5);

 

2. If Karel starts at Street 1 and Avenue 3 facing East, what row and column will Karel be on after this code runs?

move();

move();

move();

turnLeft();

move();

Street 1 and Avenue 3
Street 4 and Avenue 4
Street 2 and Avenue 6
Street 6 and Avenue 2

 

3. If Karel is facing North and the code

turnLeft();

turnLeft();

runs; which direction is Karel facing now?

North
South
East
West

 

4. What is the run method in a Java program with Karel?

A method that always makes Karel move in a square.
The method that is called just before the program ends.
The method that is called to start a Karel program.
The method that is called in order to move Karel one space forward.

 

5. What does a Karel run method look like?

A

public run()

{

//code

}

 

B

public run(){

//code

}

 

C

public void run

{

//code

}

 

D

public void run()

{

//code

}

A
B
C
D

 

6. What can be used to teach Karel to turn right?

Variables
Methods
Dog treats
Karel can already turn right

 

7. Why do we use methods in a Java program for Karel?

To stop the Java program
To display the current row that Karel is in
We do not use methods in Java
To teach Karel new commands

 

8. Which method will teach Karel how to spin in a circle one time?

A

private void spin()

{

turnRight();

}

 

B

private void spin()

{

turnLeft();

turnLeft();

turnLeft();

turnLeft();

}

 

C

private void spin()

{

turnLeft();

turnLeft();

}

 

D

private void spin()

{

move();

move();

move();

move();

}

A
B
C
D

 

9. Why do we use methods in Java programming?

Break down our program into smaller parts
Avoid repeating code
Make our program more readable
All of the above

 

10. What is top down design?

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.
Top down design is a way that you can create designs on a computer to put on a web page
Top down design is a way of designing your programs starting with the individual commands first
Top down design is a way to use loops and classes to decompose the problem

 

11. What is a code comment?

A way to teach Karel a new word
A way to give notes to the reader to explain what your code is doing
A message to your teacher in code
A place to write whatever you want in your code

 

12. How do you write a SuperKarel class?

A

public class FunProgram extends Karel

 

B

private class FunProgram extends Karel

 

C

class FunProgram extends SuperKarel

 

D

public class FunProgram extends SuperKarel

A
B
C
D

 

13. What commands does SuperKarel know that regular Karel does not?

turnLeft() and jump()
turnRight() and jump()
turnLeft() and move()
turnAround() and turnRight()

 

14. Why do we use for loops in Java?

To break out of some block of code
To do something if a condition is true
To do something while a condition is true
To repeat something for a fixed number of times

 

15. Which general for loop definition is written correctly?

A

for(true)

{

// code

}

 

B

if(i<5)

{

//code

}

 

C

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

{

//code

}

 

D

while(condition)

{

//code

}

A
B
C
D

 

16. Why do we use while loops in Java?

To break out of some block of code
To do something if a condition is true
To repeat some code while a condition is true
To repeat something for a fixed number of times

 

17. Which general while loop definition is written correctly?

A

while(x is true)

{

// code

}

 

B

if(i<5)

{

//code

}

 

C

while(int i = 0; i < count; i++)

{

//code

}

 

D

while(condition)

{

//code

}

A
B
C
D

 

18. Why do we use if statements in Java?

To break out of some block of code
To do something only if a condition is true
To do something while a condition is true
To repeat something for a fixed number of times

 

19. Which general if statement definition is written correctly?

A

for(condition)

{

// code

}

 

B

if(condition)

{

//code

}

 

C

if(int i = 0; i < count; i++)

{

//code

}

 

D

if(false)

{

//code

}

A
B
C
D

 

20. Why do we use if/else statements in Java?

To repeat something for a fixed number of times
To either do something if a condition is true or do something else
To break out of some block of code
To repeat something while a condition is true

 

21. What does an if/else statement look like in Java?

A

if(condition)

{

//code

}

 

B

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

{

//code

}

 

C

if(condition)

{

//code

}

if(condition)

{

//code

}

 

D

if(condition)

{

//code

}

else

{

//code

}

A
B
C
D

 

22. What do we use control structures for in Java?

Control the flow of the program; how the commands execute.
Start our Java program
Store information for later
Teach Karel new commands

 

23. Which of the below are examples of control structures?

(I) if

(II) if/else

(III) while

(IV) for

I only
I and II only
III and I only
I, II, III, and IV

 

24. Why should a programmer indent their code?

Helps show the structure of the code
Easier for other people to understand
Indenting is a key part of good programming style
All of the above

 

25. To maintain good style, where should brackets go in Java programming?

Before defining the run method
Always on their own line
Right after defining a method
Two brackets per line

 

26. Which of these is a valid Karel command in Java?

move();
MOVE
move;
move()

 

27. Which of these is a valid Karel command in Java?

turnLeft();
turnleft();
turnLeft()
TurnLeft

28.

public class FunKarel extends Karel

{

public void run()

{

move();

putBall();

move();

}

}

What is the name of this class?

Karel
FunKarel
Run
SuperKarel

 

29. What is the name of the method that gets called to start a Java Karel program?

go()
start()
run()
move()

 

30. Which is the correct class signature for a Karel program named CleanupKarel?

public class CleanupKarel extends Karel
public class CleanupKarel < Karel
public CleanupKarel
CleanupKarel extends Karel

 

31. Which of these methods will create a method called turnRight that will have Karel turn left three times?

 

A

private void turnRight

{

turnLeft();

turnLeft();

turnLeft();

}

 

B

private void turnRight()

{

turnLeft

turnLeft

turnLeft

}

 

C

private void turnRight()

{

turnLeft();

turnLeft();

turnLeft();

}

 

D

private turnRight()

{

turnLeft();

turnLeft();

turnLeft();

}

A
B
C
D

 

32. What is a method in Karel?

A method is the name for an entire Java program
A method is something that lets you repeat a command a fixed number of times
A method is a command that Karel can do. It has a name and a set of instructions.
A method is the way that you leave a note for someone else who reads the code.

 

33. What is top down design?

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.
Top down design is a way that you can create designs on a computer to put on a web page
Top down design is a way of designing your programs starting with the individual commands first
Top down design is a way to use loops and classes to decompose the problem

 

34. Which of these show the proper format for a Java comment?

 

A

/*

*

* My java comment

*/

 

B

/**

*

* My java comment

*/

 

C

// My java comment

 

D

All of the above

A
B
C
D

 

35. Which of these is a valid way to write a single line comment in Java?

 

A

// This is a comment

 

B

++ This is a comment

 

C

This is a comment //

 

D

/* This is a comment

A
B
C
D

 

36. What is the correct class signature in Java for a SuperKarel program?

 

A

public class FunKarel << SuperKarel

 

B

public class FunKarel extends Karel

 

C

public class FunKarel extends SuperKarel

 

D

public FunKarel extends SuperKarel

A
B
C
D

 

37. Which of these loops has Karel move 7 times?

 

A

for(int i = 1; i < 7; i++)

{

move();

}

 

B

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

{

move();

}

 

C

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

{

move();

}

 

D

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

{

move();

}

A
B
C
D

 

38. Which of these loops will run correctly 10 times?

 

A

for(int i = 0, i < 10, i++)

{

turnLeft();

}

 

B

for(int i = 0; i < 10; i + 1)

{

turnLeft();

}

 

C

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

{

turnLeft();

}

 

D

for(int i = 0; i > 10; i++)

{

turnLeft();

}

A
B
C
D

 

39. In the code snippet below, how many times will the putBall command run?

putBall();

 

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

{

putBall();

}

 

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

{

putBall();

}

100
1
3
106
107

 

40. Which of these code snippets would be the best implementation of a method called moveToWall() which moves Karel to the end of a row in the current direction?

 

A

while(frontIsClear())

{

move();

}

 

B

while(frontIsBlocked())

{

move();

}

 

C

while(frontIsClear())

{

turnLeft();

move();

}

 

D

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

{

move();

}

A
B
C
D

 

41. If Karel is not on a tennis ball, and all directions around are clear:  https://s3.amazonaws.com/f.cl.ly/items/41372Z3y2b1j2N0U1m3e/Screen%20Shot%202015-11-11%20at%209.55.24%20PM.png

What will happen when running this code?

while(noBallsPresent())

{

turnLeft();

}

Karel will not do anything
Karel will go into an infinite loop
Karel will put down a tennis ball
Karel will turn left once

 

42. What is the correct syntax for an if statement?

 

A

if frontIsClear()

{

move();

}

 

B

if(frontIsClear())

{

move();

}

 

C

if(frontIsClear())

[

move();

]

 

D

if(frontIsClear())

(

move();

)

A
B
C
D

 

43. If Karel is directly in front of a wall, which condition would properly check if a wall is in front and turn left, and otherwise would move?

if(<CONDITION>)

{

turnLeft();

}

else

{

move();

}

leftIsClear()
frontIsClear()
facingNorth()
frontIsBlocked()

 

44. Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?

An if statement
A for loop
A while loop
A nested while loop

 

45. Say you want to write a program to have Karel to pick up all of the tennis balls in a location, but you don’t know how many tennis balls there are. Which control structure would you use?

An if statement
A for loop
A while loop
An if/else statement

 

46. What is a condition in Karel programming?

The place in code where the program stops running.
A method that returns a true or false answer. Typically used within a control structure.
The number of times a program loops.
What karel does during the program.

 

47. What is wrong with the style of this method declaration?

private void spinKarel() {

turnLeft();

turnLeft();

turnLeft();

turnLeft();

}

(I) Indenting is wrong

(II) No comment

(III) Not using camelCasing for name

(IV) Brackets are not on their own line

I only
I and II
IV only
I, II, and IV
II and III

 

48. What is wrong with this method declaration?

public karelDance()

[

move();

turnLeft();

move();

turnLeft();

move();

]

(I) Not using curly brackets

(II) Missing void

(III) Using public instead of private

(IV) Illegal characters in the method name

I only
I and II
I, II, and III
I, II, III, IV

 

49. How can we teach Karel new commands?

A for loop
A while loop
Define a new method
The run method

 

50. Why does a programmer indent their code?

Helps show the structure of the code.
Easier for other people to understand.
A key part of good programming style!
All of the above
 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Machine Learning- Perception,Linear Regression, Booting

Machine Learning- Perception,Linear Regression, Booting

Perceptron, SGD, Boosting

1. Consider running the Perceptron algorithm on a training set S arranged in a certain order. Now suppose we run it with the same initial weights and on the same training set but in a different order, S′. Does Perceptron make the same number of mistakes? Does it end up with the same final weights? If so, prove it. If not, give a counterexample, i.e. an S and S′ where order matters.

2. We have mainly focused on squared loss, but there are other interesting losses in machine learning. Consider the following loss function which we denote by φ(z) = max(0,−z). Let S be a training set (x1,y1), . . . , (xm,ym) where each xi ∈ Rn and yi ∈{−1, 1}. Consider running stochastic gradient descent (SGD) to find a weight vector w that minimizes 1

m

∑m i=1 φ(y

i · wTxi). Explain the explicit relationship between this algorithm and the Perceptron algorithm. Recall that for SGD, the update rule when the ith example is picked at random is

wnew = wold −η∇φ ( yiwTxi

) .

3. Here we will give an illustrative example of a weak learner for a simple concept class. Let the

domain be the real line, R, and let C refer to the concept class of “3-piece classifiers”, which are functions of the following form: for θ1 < θ2 and b ∈ {−1, 1}, hθ1,θ2,b(x) is b if x ∈ [θ1,θ2] and −b otherwise. In other words, they take a certain Boolean value inside a certain interval and the opposite value everywhere else. For example, h10,20,1(x) would be +1 on [10, 20], and −1 everywhere else. Let H refer to the simpler class of “decision stumps”, i.e. functions hθ,b such that h(x) is b for all x ≤ θ and −b otherwise.

(a) Show formally that for any distribution on R (assume finite support, for simplicity; i.e., assume the distribution is bounded within [−B, B] for some large B) and any unknown labeling function c ∈ C that is a 3-piece classifier, there exists a decision stump h ∈ H that has error at most 1/3, i.e. P[h(x) 6= c(x)] ≤ 1/3.

(b) Describe a simple, efficient procedure for finding a decision stump that minimizes error

with respect to a finite training set of size m. Such a procedure is called an empirical risk minimizer (ERM).

(c) Give a short intuitive explanation for why we should expect that we can easily pick m

sufficiently large that the training error is a good approximation of the true error, i.e. why we can ensure generalization. (Your answer should relate to what we have gained in going from requiring a learner for C to requiring a learner for H.) This lets us conclude that we can weakly learn C using H.

1

 

 

4. Consider an iteration of the AdaBoost algorithm (using notation from the video lecture on Boosting) where we have obtained classifer ht. Show that with respect to the distribution Dt+1 generated for the next iteration, ht has accuracy exactly 1/2.

2

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Exp22_Excel_Ch01_Cumulative_Medical

Exp22_Excel_Ch01_Cumulative_Medical

Exp22_Excel_Ch01_Cumulative_Medical

Exp22 Excel Ch01 Cumulative Medical

Excel Chapter 1 Cumulative – Medical Expenses

 

Project Description:

You track your medical expenses each month. You developed a worksheet that contains dates, descriptions, amount billed, and applicable copayments. Your health insurance provider details the amount not covered and how much was covered by insurance. You want to create formulas, format the worksheet to improve readability, and copy the worksheet to use as a template for the next month.

 

Start Excel. Download and open   the file named Exp22_Excel_Ch01_Cumulative_Medical.xlsx.   Grader has automatically added your last name to the beginning of the   filename.

 

You notice that the 3/21/2024   Vision expense on Row 10 is a duplicate of the expense on Row 8. You will   delete the duplicate row.
Select and delete row 10 that contains the duplicate 3/21/2024 Vision data.

 

You want to move the 3/2/2024   Pharmacy expense to be listed in chronological order.
Select and cut row 11 that contains the 3/2/2024 Pharmacy expense and insert   cut cells on row 5.

 

You decide to insert a column   for additional data.
Insert a new column A and type Expense # in cell A3.

 

In the new column, you want to   create a coding system consisting of the year, month, and sequential   numbering for the expenses.
Type 2024-03-001 in cell A4 and use Auto Fill to   complete the expense numbers to the range A5:A11.

 

After filling in the expense   numbers, you will increase the column width to display the data.
Change the width of column A to 12.

 

The worksheet should have a   title above the data.
Type March   2024 Medical Expenses   in cell A1 and merge and center the title over the range A1:J1.

 

The title would look more   professional with some formatting.
Apply bold, Green font color, and 14-pt font size to the title in cell A1.

 

You decide to replace Lab with   Laboratory to provide a more descriptive expense name.
Find all occurrences of Lab and replace them with Laboratory.

 

The worksheet contains spelling   errors that need to be identified and corrected.
Check the spelling in the worksheet and correct all spelling errors.

 

You are ready to enter the first   formula to calculate the adjusted rate.
Calculate the Adjusted Bill in cell F4 by subtracting the Amt Not Covered   from the Amount Billed. Copy the formula to the range F5:F11.

 

Next, you will calculate the   amount owed.
Calculate the Amount Owed in cell I4 by subtracting the Insurance Paid and   Copay from the Adjusted Bill. Copy the formula to the range I5:I11.

 

Finally, you will calculate the   percentage paid of the adjusted bill.
Calculate the % Pd of Adj Bill in cell J4 by adding the Copay and Amount Owed   and then dividing that amount by the Adjusted Bill. Copy the formula to the   range J5:J11.

 

The first row of monetary values   should be formatted with dollar signs.
Apply Accounting Number Format to the range D4:I4.

 

For the remaining rows of   monetary values, you decide to apply Comma Style.
Apply Comma Style to the range D5:I11.

 

The percentage paid column needs   to be formatted with percent signs.
Apply Percent Style with one decimal place to the range J4:J11.

 

Formatting the column headings   on the third row will provide a professional appearance.
Wrap text, bold, and horizontally center the labels in the range A3:J3.

 

You want to continue formatting   the column headings.
Apply Green fill and apply Thick Bottom Border to the range A3:J3.

 

You will apply a cell style for   the last three columns that represent your costs.
Apply the Good cell style to the range H4:J11.

 

For the last column, you want to   format the percentages below the column heading.
Apply Align Right and indent once the data in the range J4:J11.

 

Changing the page orientation   will enable the data to better fit on a printout.
Select landscape orientation.

 

Next, you are ready to set the   top margin and center data on the page.
Set a 1-inch top margin and center the worksheet horizontally between the   left and right margins.

 

To make the data easier to read,   you will increase the scaling.
Set 110% scaling.

 

Insert a footer with the text Exploring   Series on the   left side, the sheet name code in the center, and the file name code on the   right side of the worksheet.

 

You will rename the sheet tab   and copy the worksheet to start creating a template for the next month.
Rename Sheet1 as March. Copy the worksheet, place the duplicate to the right, and then   rename it as April.

 

You will make some changes on   the April worksheet so that it will be ready for data entry.
Change the title to April 2024 Medical Expenses in the April worksheet. Delete   data in ranges A4:E11 and G4:H11. The formula results in column J display   #DIV/0! because you deleted the data, which generates a divide by zero error.   Type 1 in cell D4 and copy the value   to the range D5:D11 as placeholder values to avoid displaying the error   results

 

Save and close Exp22_Excel_Ch01_Cumulative_Medical.xlsx.   Exit Excel. Submit the file as directed.

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Vending Machine JAVA Program Assignment Help

Vending Machine JAVA Program Assignment Help

Please do the following to complete this assignment.

Purpose:

The purpose of this project is to provide non-trivial practice in the use of Java object-oriented programming features to implement an object-oriented design and have a bit of fun doing it.

Resources Needed:

You will need a computer system with Java 7 or greater SE edition run-time and Java Development Kit (JDK). You may optionally use a Java IDE for example NetBeans, Eclipse, etc. However application builders are not allowed.

Submitted Files:

Design and Analysis:

This is an informal essay-style single-spaced word-processed document. The file formats accepted will be announced at project assignment. The length of the document should be between 1 and 1.5 pages. The following subjects should be discussed in this order:

1. General program design. How is the program organized? What major data structures were used? How did you divide the functionality among your classes? How are commands processed? Etc.

2. What alternative approaches were considered and why were they rejected?

3. What did you learn from doing this project and what would you do differently?

Source files:

Each public class must be contained in a separate Java source file. Only one source file will have a main() method and this source will be named VendingMachineSimulator.java. Other source/class names are up to you following the guidelines specified so far in the course.

The format of the Java source must meet the general Java coding style guidelines discussed so far during the course. Pay special attention to naming guidelines, use of appropriate variable names and types, variable scope (public, private, protected, etc.), indentation, and comments. Classes and methods should be commented with JavaDoc-style comments (see below). Please use course office hours or contact the instructor directly if there are any coding style questions.

JavaDocs:

Sources should be commented using JavaDoc-style comments for classes and methods. Each class should have a short comment on what it represents and use the @author annotation. Methods should have a short (usually 1 short sentence) description of what the results are of calling it. Parameters and returns should be documented with the @param and @return annotations respectively with a short comment on each.

JavaDocs must be generated against every project Java source file. They should be generated with a –private option (to document all protection-level classes) and a d [dir] option to place the resulting files in a javadocs directory/folder at the same level as your source files. See the JavaDocs demonstration for more details.

Submit file:

The submit file is to be a Zip file containing your design and analysis document, your Java sources, and your javadocs directory/folder. Any appropriate file name for this Zip file is acceptable.

If you know how to create a standard Java JAR file, this is also acceptable for your source code. However, make sure you include the source code in your JAR file.

Program Specification:

1. Create a new multi-class Java program which implements a vending machine simulator which contains the following functionality:

A) At program startup, the vending machine is loaded with a variety of products in a variety of packaging for example soda/tonic/Coke in bottles, peanuts in bags, juice in cartons, etc. Also included is the cost of each item. The program should be designed to easily load a different set of products easily (for example, from a file).

Also at program startup, money should be loaded into the vending machine. Money should consist of different monetary objects for the specified currency for example $1 bills, $5 bills, quarters, dimes, etc. Your program should be designed to use different national currencies easily (for example the Euro) without changing source code. Money should be maintained as paper bills and coins, not just amounts.

B) A menu of commands must be provided. At a minimum the menu should consists of the following commands:

1. Display the list of commands

2. Display the vending machine inventory. For each item, this command should result in displaying a description and current quantity.

3. Display the money currently held in the vending machine.

4. Purchase an item. The result of this selection should be the following actions:

1. Prompt the user to indicate what item to purchase

2. Prompt the user to specify what monetary items are being used for payment (the actual items for example quarters, dimes, etc.), not a money amount

3. If the user specified enough money to purchase the selected item, the item is purchased (deducted from inventory), supplied money is added to the vending machine, and any change is returned in the form of monetary items (quarters, dimes, etc.).

4. If the user did not specify enough money for the selected item, the transaction is aborted with the supplied money not added to the machine (not accepted) and the product not purchased (i.e. the state of the vending machine is unchanged).

5. Exit – exits the program displaying a departing message.

2. Additional points to consider:

A) You can use the Java Standard Edition (SE) API library as supplied by Oracle (AKA Sun) except the collection classes other than String and standard arrays (i.e. not ArrayList, Map, Vector, etc.). These other collections will be covered later in the course.

B) When developing complex classes, consider creating a main() method to test them out. Once tested successfully, delete the main() method.

C) You should generate error messages when appropriate, for example on invalid input values or not enough money supplied for the selected item to purchase. Exceptions will be covered later in the course so for this program displaying appropriate messages on the console is fine.

Other Activates:

1. Observe the presentation on JavaDocs.

2. Observe the Vending Machine Simulator demonstration for an example of one implementation.

3. Create a compressed zipped folder containing your Design and Analysis document, your Java source code files, and your javadocs folder.

4. Submit your compressed zipped folder.

Assignment Rubric:

Part 70% 80% 90% 100% % of
          Grade
Design and All but one subject All assigned All assigned subjects All assigned 15%
Analysis addressed with subjects address address with subjects address  
Document relevant, with mostly accurate and with accurate,  
  information. Few relevant relevant. Nicely relevant, and  
  minor information. formatted document. insightful  
  typographical Nicely formatted Document is within information. Very  
  issues. Document document. assigned length nicely formatted.  
  is close to assigned Document is   Document is  
  length close to assigned   within assigned  
    length   length  
Functionality Majority of Most required Nearly all required All required 55%
  required function function parts function parts work function parts  
  parts work as work as indicted as indicted in the work as indicted  
  indicted in the in the assignment text in the assignment  
  assignment text. assignment text above and submitted text above and  
  One major or 3 above and documentation. One submitted  
  minor defects. All submitted to two minor documentation.  
  major functionality documentation. defects.    
  at least partially One major or 3      

image1.jpg

image2.jpg working (example minor defects.      
  change provided All major      
  but not correct). functionality at      
  Design document least partially      
  does not fully working      
  reflect ((example      
  functionality. change provided      
    but not correct).      
Code Majority of the Most of the code Almost all code All code 25%
  code conforms to conforms to conforms to coding conforms to  
  coding standards as coding standards standards as coding standards  
  explained and as explained and explained and as explained and  
  demonstrated so far demonstrated so demonstrated so far demonstrated so  
  in the course (ex. far in the course in the course (ex. far in the course  
  method design, (ex. method method design, (ex. method  
  naming, design, naming, naming, formatting, design, naming,  
  formatting, etc.). formatting, etc.). etc.). One to two formatting, etc.).  
  Five to six minor Three to four minor coding Appropriate level  
  coding standard minor coding standard violations. of useful  
  violations. Some standard Appropriate level of comments.  
  useful comments. violations. useful comments. Complete  
  Some JavaDocs Mostly useful Public class JavaDocs as  
  commenting. comments. JavaDocs complete. specified. Code  
  Code compiles Public class Code compiles. compiles with no  
  with multiple JavaDocs Code compiles with errors or  
  warnings or fails to complete. Code no errors or warnings.  
  compile with compiles with warnings.    
  difficult to one to two      
  diagnose error. warnings.      
Submit More than one file All but one file All file submitted in All file submitted 5%
package submitted in submitted in correct format but in correct file  
  incorrect format. correct format. not in the specified formats and  
  Files not enclosed Files not compressed file. compressed as  
  in the specified enclosed in the   specified.  
  compressed file. specified      
    compressed file.  
 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!