Questions
Write this code in python Debugging: Use the Debugging Coin Toss code below as the basis...

Write this code in python Debugging:

Use the Debugging Coin Toss code below as the basis for this project. Get the program running exactly as it appears in the text. It will run as written. Although it runs, does it run (behave) correctly? That is where you will focus your debugging efforts.

Code:

import random

guess = ' '

while guess not in ('heads', 'tails'):

     print('Guess the coin toss! Enter heads or tails: ')

     guess = input()

toss = random.randint(0, 1) # 0 is tails, 1 is heads

if toss == guess:

    print('You got it!')

else:

    print('Nope! Guess again!')

    guess = input()

    if toss == guess:

        print('You got it!')

   else:

        print('Nope. You are really bad at this game.')

Tasks Your program is to accomplish the following:

1. Welcome the user to the program

2. Keep the program flow of the original text. You will probably add to the original text, but totally rewriting the code is neither required nor desired.

3. Use debugging tools to identify if/where there is an issue with the program

4. Required: Enable logging and place logging messages in your source code. See text examples for purpose and placement of logging messages.

At a minimum, have start and end program logging messages and logging messages when variable values are changed/updated.

Write the log messages to a file ‘coin_toss_log.txt’. Log messages should not go to the screen.

5. Required: Use assertions in your source code. At a minimum, place two assertions in your code.

I recommend placing assertions to do ‘sanity’ checks on variable (guess and toss) values and types.

6. Required: Leave all your debugging code in your source code. If I don’t see it, you didn’t do it.  

7. Recommended. Run your coin_toss program with IDLE’s debugger enabled. Watch the variables closely; value and type.

8. Optional. Use other tools addressed in our text. Experiment, explore, play.  

Notes - Study the code and determine what debugging tools you can use, and where to use them, to help you determine if this program is running correctly, and if not, how to correct it. - Work on your screen output. Put effort towards an attractive output that a user/gamer would find appealing. -

In: Computer Science

•From the e-Activity, determine the type of cache memory (i.e., Level 1, Level 2, or another...

•From the e-Activity, determine the type of cache memory (i.e., Level 1, Level 2, or another type) that resides on a computer that you own or on a computer that you would consider purchasing. Examine the primary manner in which the type of cache memory that you have identified interfaces with the CPU and memory on your computer. Determine which type of cache memory is the most efficient, and provide one (1) example that depicts the manner in which the use of one (1) type of cache memory makes your computer processing more efficient than another. •Evaluate the advantages and disadvantages of both symmetrical and master-slave multiprocessing systems in regards to computer processing speed, multiprocessing configuration, overheating, and cost. Of the two (2), recommend the type of processor that would be better suited for a computer that is primarily used for the following: Word processing, Microsoft Excel spreadsheets, and computer gaming. Provide a rationale for your response.

In: Computer Science

1) Describe the issues regarding Net Neutrality. 2) Discuss the negatives from the perspective of an...

1) Describe the issues regarding Net Neutrality.

2) Discuss the negatives from the perspective of an ISP.
Give more details. Thank you.

In: Computer Science

using c language: create an array of the values of a sine wave. Include the math.h...

using c language:

create an array of the values of a sine wave. Include the math.h header to use the sin floating point function. The function sin takes an argument of radians (not degrees). Make your array721 elements and initialize each element with 10 * sin(2*3.1416* (i/360.0) where i is the array index from 0 - 720. When done properly, the array should contain approximately 2 complete sine wave cycles. Similarly, create an array of 721 elements only this time initialize it with a cosine function with amplitude 5 Have the program process and compute the following (in the order given); display the title of the action and answers on the screen: The maximum value of the cos and sin array added together. The mean value of the sin array The mean value of the element by element product of the sin and cos. The median value of the cos array. The dot product of the cos and sin array. The dot product of a reversed cos array with a sin array.

In: Computer Science

Access and review the brief article on "Why Networking is Important in Your Everyday Life" by...

Access and review the brief article on "Why Networking is Important in Your Everyday Life" by Tatiana Maldonado on the Network After Work blog.

In what ways do computer networks impact your everyday life? Share at least one area, not included in Ms. Madonado's article, in which networks are a part of or have an effect on your life.

In: Computer Science

If you search on the Web for the major issues of wireless networks, you'll find numerous...

If you search on the Web for the major issues of wireless networks, you'll find numerous articles and documents that identify 3 or more (mostly more) issues or challenges of wireless networks. Do this research and list what you believe to be the 5 most important or problematic issues facing the design, implementation, or operations of a wireless network.

In: Computer Science

1.Which players have lost more matches than the average number of losses?   No duplicates should be...

1.Which players have lost more matches than the average number of losses?   No duplicates should be listed.   Order by player number.   Insert your screen shot here.

2.How many players from each town served on the committee in any capacity? Display the town as ‘Town’ and the number served as ‘Committee Service’.   Insert your screenshot here.

3.How many members come from each town? Display the town as ‘Town’ and the number of members as ‘Number’. Insert your screenshot here.

4.Who has served on the committee more than once? Display the player number as ‘Number’, concatenate the player initial and name as ‘Name’, town as ‘Town’, and number served as ‘Terms’. Insert your screenshot here.

Below I will include the tennis database

* *******************************************************************

CREATE and OPEN the TENNIS Base

******************************************************************* */

Create database tennis;

USE tennis;

#--Create table players and fill it--------------------------

Create table players

(

playerno              int                         not null                primary key,

name                    varchar(15)         not null,

initials   varchar(3),

birth_date           date,

gender                 char(1),

joined                   int          not null,

street                   varchar(15)         not null,

houseno                             varchar(4),

zip                         char(6),

town                     varchar(10)         not null,

phoneno                             char(10),

leagueno             char(4)

);

Insert into players values

(2,'Everett','R','1988-01-09','M',2000,'Stoney Road','43','3575NH','Stratford','070-237893','2411'),

(6,'Paramenter','R','1984-06-25','M',2002,'Haseltine Lane','80','1234KK','Stratford','070-476547','8467'),

(7,'Wise','GWS','1983-05-11','M',2006,'Edgecombe Way','39','9758VB','Stratford','070-347689',Null),

(8,'Newcastle','B','1982-07-08','F',2005,'Station Road','4','6584RO','Inglewood','070-458458','2983'),

(27,'Collins','DD','1990-05-10','F',2008,'Long Drive','804','8457DK','Eltham','079-234857','2513'),

(28,'Collins','C','1983-06-22','F',2008,'Old Main 28','10','1294QK','Midhurst','071-659599',Null),

(39,'Bishop','D','1986-10-29','M',2005,'Eaton Square','78','9629CD','Stratford','070-393435',Null),

(44,'Baker','E','1983-09-01','M',2010,'Lewis Street','23','4444LJ','Inglewood','070-368753','1124'),

(57,'Brown','M','1981-08-17','M',2007,'Edgecombe Way','16','4377CB','Stratford','070-473458','6409'),

(83,'Hope','PK','1976-11-11','M',2009,'Magdalene Road','16A','1812UP','Stratford','070-353548','1608'),

(94,'Miller','P','1993-05-14','M',2013,'High Street','33A','5746OP','Douglas','070-867564',Null),

(100,'Parmenter','P','1983-02-28','M',2012,'Haseltine Lane','80','1234KK','Stratford','070-494593','6524'),

(104,'Moorman','D','1990-05-10','F',2014,'Stout Street','65','9437AO','Eltham','079-987571','7060'),

(112,'Bailey','IP','1983-10-01','F',2014,'Vixen Road','8','6392LK','Plymouth','010-548745','1319');

#--Create the table committee_members and fill it--------------------

Create table committee_members

(

playerno              int          not null,

begin_date          date       not null,

end_date             date,

position               varchar(20),

primary key(playerno, begin_date)

);

Insert into committee_members values

(2,'2010-01-01','2012-12-31','Chairman'),

(2,'2014-01-01',Null,'General Member'),

(6,'2010-01-01','2010-12-31','Secretary'),

(6,'2011-01-01','2012-12-31','General Member'),

(6,'2012-01-01','2013-12-31','Treasurer'),

(6,'2013-01-01',Null,'Chairman'),

(8,'2010-01-01','2010-12-31','Treasurer'),

(8,'2011-01-01','2011-12-31','Secretary'),

(8,'2013-01-01','2013-12-31','General Member'),

(8,'2014-01-01',Null,'General Member'),

(27,'2010-01-01','2010-12-31','General Member'),

(27,'2011-01-01','2011-12-31','Treasurer'),

(27,'2013-01-01','2013-12-31','Treasurer'),

(57,'2012-01-01','2012-12-31','Secretary'),

(94,'2014-01-01',Null,'Treasurer'),

(112,'2012-01-01','2012-12-31','General Member'),

(112,'2014-01-01',Null,'Secretary');

#--Create the table matches and Fill it-------------------

Create table matches

(

matchno                             int          not null Primary Key,

teamno                int          not null references teams(teamno),

playerno              int          not null references players(playerno),

won                      int,

lost                       int

);

Insert into matches values

(1,1,6,3,1),

(2,1,6,2,3),

(3,1,6,3,0),

(4,1,44,3,2),

(5,1,83,0,3),

(6,1,2,1,3),

(7,1,57,3,0),

(8,1,8,0,3),

(9,2,27,3,2),

(10,2,104,3,2),

(11,2,112,2,3),

(12,2,112,1,3),

(13,2,8,0,3);

#--Create Table Penalties and Fill it-------------------------------------

create table Penalties

(

paymentno         int          not null Primary Key,

playerno              int          not null references players(playerno),

payment_Date   date       not null,

amount decimal(10,2)     not null

);

Insert into Penalties values

(1,6,'2010-12-08',100.00),

(2,44,'2011-05-05',75.00),

(3,27,'2013-09-10',100.00),

(4,104,'2014-07-08',50.00),

(5,44,'2010-12-08',25.00),

(6,8,'2010-12-08' ,25.00),

(7,44,'2012-12-30',30.00),

(8,27,'2014-08-12',75.00);

#--Create Table Teams and Fill it----------------------------------------------

Create table teams

(

teamno int          Primary Key        Not Null,

playerno              int          Not Null               references players(playerno),

division varchar(6)

);

Insert into teams values

(1,6,'first'),

(2,27,'second');

/* ********************************************************************************************

End of loading the database

******************************************************************************************** */

In: Computer Science

for eclipse java Overview Write a program that translates an English phrase into a Pig Latin...

for eclipse java

Overview
Write a program that translates an English phrase into a Pig Latin phrase. Input a phrase from the user and translate it to pig latin. You can assume the phrase will be on a single line.

Use at least the REQUIRED METHODS listed below, with the exact same SPELLING for method names and parameters.

Input Specification
The input will be an English phrase, with NO terminal punctuation. Read the phrase as a SINGLE STRING using the nextLine method.

Use PRECISELY the format below with the EXACT same SPACING and SPELLING.

Please enter a phrase ==> <user input>
Output Specification
Output an introductory message, a prompt for the English word, and a translation for the inputted word.

Use PRECISELY the format below with the EXACT same SPACING and SPELLING. The output below assumes the user entered "Humpty Dumpty sat on the wall".

This program will convert an English phrase into Pig Latin.

Please enter a phrase ==> Humpty Dumpty sat on the wall

"Humpty Dumpty sat on the wall"
in Pig Latin is
"umpty-Hay umpty-Day at-say on-way e-thay all-way"

************************
Required Methods

// Prompt and read a phrase to translate
public static String readPhrase (Scanner console)

// Convert a phrase to Pig Latin and return it
public static String convertPhrase (String englishPhrase)

// Convert a word to Pig Latin and return it
public static String convertWord (String englishWord)

// Return true if "c" is a vowel, false otherwise.
// Handle both lowercase and uppercase letters.
public static boolean isVowel (char c)

// Print result of translation
public static void printResult (String englishPhrase, String pigLatinPhrase)
Hints
You already wrote a method to convert a single word (convertWord). Apply it to each word in the phrase, forming the translated phrase by concatenating the translated words. If you did not get convertWord working on the first lab assignment, you need to get it working now.

Class Scanner can process a String (instead of System.in) consisting of multiple words, and break it into words that are separated by whitespace (tabs, spaces, and newline characters). You know other ways to break a line into words, so you do NOT have to use this technique.

Correctly handle whitespace before and after words.

In: Computer Science

Q5:      Which type of RAM is used exclusively in laptops? SODIMM DDR3 DDR DDR4 Q6:      Which...

Q5:      Which type of RAM is used exclusively in laptops?

  • SODIMM
  • DDR3
  • DDR
  • DDR4

Q6:      Which firmware security standard can be used to store disk encryption keys?

  • SLA
  • TPM
  • UEFI
  • USB

Q7:      Which RAID level is Disk Mirroring?

  • 3
  • 1
  • 0
  • 5

Q8:      Which type of printer uses toner?

  • Impact
  • Inkjet
  • Thermal
  • Laser

Q9:      Which technique do 3D printers use to create objects?

  • Fusing
  • Heating
  • Layering
  • Carving

Q10:    Which of the following item DOES NOT store data?

  • Random Access Memory
  • CD-R
  • LCD Screen
  • USB Drive

In: Computer Science

In Java Design a Triangle class (Triangle.java) that extends GeometricObject. Draw the UML diagram for both...

In Java

Design a Triangle class (Triangle.java) that extends GeometricObject. Draw the UML diagram for both classes and implement Triangle. The Triangle class contains: ▪ Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. ▪ A no-arg constructor that creates a default triangle. ▪ A constructor that creates a triangle with the specified side1, side2, side3, color, and filled arguments. ▪ The accessor methods for all three data fields. ▪ A method named getArea() that returns the area of this triangle. ▪ A method named getPerimeter() that returns the perimeter of this triangle. ▪ A method named toString() that returns a string description for the triangle. return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; The formulas to compute the area of a triangle are as follows: ? = (????1 + ????2 + ????3) 2 ???? = √?(? − ????1)(? − ????2)(? − ????3) The implementation for the Triangle’s toString() method is as follows: return "Triangle:\n" + super.toString() + "\nTriangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; Download the attached project: HomeworkCh11.zip. Complete the HomeworkCh11.java test program as follows 1. Prompt the user to enter a. Each of the three sides of a triangle, b. the Triangle’s color, and c. whether the triangle is filled. 2. The program should create a Triangle object with these sides and set the color and filled properties using the input. 3. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not. 4.

Create an ArrayList and add at least one of each of the following objects to it: Triangle, String, Rectangle, Date, Circle. The list should contain at least seven objects.

The implementation for instantiating the ArrayList and adding objects to it is as follows: ArrayListlist = new ArrayList(); list.add(new Circle(1.5, "green", true)); list.add(new Date()); 5. Create a loop to display all the elements in the list by invoking its toString method. Use the instanceof operator to invoke the correct getArea() and getPerimeter() methods to display additional information about each shape object.

In: Computer Science

Java programming Create a application with a method void (after main() ) that creates an array...

Java programming

Create a application with a method void (after main() ) that creates an array and asks for the user fill it with float numbers.
This array have infinite elements until the user decide that it is enough and input a command to stop.

Display this array's elements data in another method void.

Thanks for your help!

In: Computer Science

C++ Create a program which randomly generates 3 sets of x and y Integers and one...

C++

Create a program which randomly generates 3 sets of x and y Integers and one randomly generated Integer. Two of the sets of Integers will represent the end points of a line segment. The other set of Integers and the other Integer will represent the midpoint of a circle and its radius.

The coordinates should be randomly generated using a user defined function that returns an Integer value based on from and to parameters; see the function declaration in the Other section below. Your coordinates should be randomly selected from -99 to 99. The radius should be a randomly generated number (using the same function) from 1 to 200.

Two other functions should be created to determine if a line segment is wholly within a circle. One of the functions should return the length of a line segment and the other will return a Boolean indicating if the passed line segment is in the passed circle; again, see the function declarations below.

The program should display all of the generated data and one of the messages regarding the location of the line as shown below in Output Layout section. Try to make everything line up correctly.

Output Layout:

Coordinates of a Random Line Segment
  1st Point's x coordinate: -##
  1st Point's y coordinate: -##
  2nd Point's x coordinate: -##
  2nd Point's y coordinate: -##
    
Coordinates of a Random Circle
  coordinate: -##
  coordinate: -##
  Radius: ###
    
The line segment is within the circle.
  OR
The line segment is not within the circle.

Other: (Required Identifier Names, Prototypes & Random Ranges)

p0x    // an int from -99 to 99
p0y    // an int from -99 to 99
p1x    // an int from -99 to 99
p1y    // an int from -99 to 99
mpx    // an int from -99 to 99
mpy    // an int from -99 to 99
radius // an int from 1 to 200
    
int randomInteger(const int from, const int to);
int lineSegLength(const int p0x, const int p0y, const int p1x, const int p1y);
bool lineInCircle(const int p0x, const int p0y, const int p1x, const int p1y, const int mpx, const int mpy, const int radius);

In: Computer Science

how to access server room, and how to remove signs when exit the gate door.

how to access server room, and how to remove signs when exit the gate door.

In: Computer Science

There are a variety of security mechanisms available to protect the enterprise network. Discuss how an...

There are a variety of security mechanisms available to protect the enterprise network. Discuss how an enterprise might be attacked and the type of security device or mechanism you would select to combat the attack. What would you envision as being the legal, social, and ethical implications of using the security device or mechanism?

In: Computer Science

We can find and sort the k largest elements of a set of size n in...

We can find and sort the k largest elements of a set of size n in Θ(n + k log k) worst-case time.

Is this statement true?

In: Computer Science