Questions
write a java code to implement a linked list, called CupList, to hold a list of...

write a java code to implement a linked list, called CupList, to hold a list of Cups.

1.Define and write a Cup node class, called CupNode, to hold the following information about a cup:

•number (cup number)

•capacity (cup capacity in ml)

•Write a method size() that returns the number of elements in the linkedlist CupList.

•Write a method getNodeAt() that returns the reference to cup node object at a specific position given as a parameter of the method.

•Write a method, insertPos(),  to insert a new CupNode object at a specific position given as a parameter of the method.

•Write a method, deletePos(),  to remove the CupNode object at a specific position given as a parameter of the method.

•Write a method, swapNodes,  to swap two nodes at two positions pos1 and pos2 given as parameters of the method.

Implement the Cup list using double linked list.

•Update CupNode class by adding a link to the previous node in the list. Then update the constructor of the class

•Update the CupList by adding a last attribute, to hold the reference to the last node of the list.

•Implement the following methods in CupList isEmpty(), size(), insertAtFront(), insertAtRear(), insertAt(), removeFirst(), removeLast(), removeAt().

  CupNode should have a constructor and methods to manage the above information as well as the link to next node in the list.

2.Define and write the CupList class to hold objects of the class CupNode. This class should define:

a)a constructor,

b)a method isEmpty() to check if the list is empty or not,

c)a method insert() that will allow to insert a new cup node at the end of the list,

d)a method print() that will allow to print the content of the list,

e)A method getCupCapacity() that will return the capacity of a cup given its number. The method should first find out if a cup with that number is in the list.

3.Write a TestCupList class to test the class CupList. This class should have a main method in which you perform the following actions :

a)Create a CupList object,

b)Insert five to six CupNode objects into the created Cup List,

c)Print the content of your cup list,

d)Search for a given cup number in the list and print out its capacity.

In: Computer Science

Write a Python program to simulate a very simple game of 21 •Greet the user. •Deal...

Write a Python program to simulate a very simple game of 21
•Greet the user.
•Deal the user a card and display the card with an appropriate message.
•Deal the user another card and display the card
.•Ask the user if they would like a third card. If so, deal them another card and display the value with an appropriate message.
•Generate a random number between 10 and 21 representing the dealer’s hand. Display this value with an appropriate message.
•If the user’s total is greater than the dealer’s hand and the user’s total is NOT greater than 21, the user wins, otherwise the dealer wins. Display the player’s and the dealer’s totals along with an appropriate message indicating who won.

In: Computer Science

•From the e-Activity, determine what you believe is the most critical component of BCP from FEMA’s...

•From the e-Activity, determine what you believe is the most critical component of BCP from FEMA’s implementation / suggestions for the BCP process. Justify your answer. •Determine whether or not you believe the BCP process would be successful without proper BIA processes being conducted. Explain why or why not

In: Computer Science

Describe your opinion of why some collaborative interfaces, such as email, are much more popular than...

Describe your opinion of why some collaborative interfaces, such as email, are much more popular than others, such as video-conferencing. Compare and contrast your method with at least two of your peers' responses.

In: Computer Science

Write C++ statements that will align the following three lines as printed in two 20 character...

Write C++ statements that will align the following three lines as printed in two 20 character columns.

Item                                                    Price

Banana Split                                                   8.90

Ice Cream Cake                                            12.99

In: Computer Science

CSIS 113A C++ Programming Level1 Rock, Paper, Scissors Introduction In this assignment you will create a...

CSIS 113A C++ Programming Level1

Rock, Paper, Scissors

Introduction

In this assignment you will create a program that will simulate the popular children’s game “Rock, Paper, Scissors”; using only Boolean logic and practice using the for-loop and logical operators as well as continue getting used to data of various types.

Skills: string input/output, data types, logical operators, and control structures

Rock-Paper-Scissors

Rock-Paper-Scissors is a game where two players, on the count of 3, show the rock/paper/scissors symbol with their hand. Rock smashes scissors, scissors cuts paper, and paper covers rock:

Once both players have played valid gestures, there are two ways to determine the winner: one using string comparison and Boolean logic and the other using modular arithmetic; you’ll write a solution using both approaches. For this assignment, only “rock”, “paper”, and “scissors” are considered valid gestures.

Definitions:

1. Valid game: a game in which both players select a valid gesture

2. Invalid game: a game in which a player selects a gesture that is not “rock”, “paper”, or “scissors”. (HINT: DeMorgan’s law will help negation of valid game)

main.cpp

Your program should use a for-loop to play 7 consecutive games (must be a variable) of Rock-PaperScissors determining the winner using only the four decision statements. For each game, your program should:

1) Prompt Player 1 for their selection. The inputs for each game are given below. a. If Player 1 enters an invalid selection you should update the count of invalid games and then begin a new game.

2) Prompt Player 2 for their selection. The inputs for each game are given below.

a) If Player 2 enters an invalid selection you should update the count of invalid games and then begin a new game.

3) If both players have selected a valid gesture determine the winner using string comparison and if/else logic.

4) For each valid game completed, update the count of the number of wins by Player 1, the number of wins by Player 2, or the number of ties as needed.

Test input:

• Game 1: Player one plays “scissors” and Player 2 plays “paper”

• Game 2: Player 1 plays “paper” and Player 2 plays “papers”

• Game 3: Player 1 plays “rock” and Player 2 plays “rock”

• Game 4: Player 1 plays “rocks”

• Game 5: Player 1 play “paper” and Player 2 plays “scissors”

• Game 6: Player 1 plays” scissors” and Player 2 plays “rock”

• Game 7: “Player 1 plays “paper” and Player 2 plays “rock”

Test Run: Your code should look exactly like the one below

Player 1 Enter Selection: scissors

Player 2 Enter Selection: paper

Player 1 Enter Selection: paper

Player 2 Enter Selection: papers

Player 1 Enter Selection: rock

Player 2 Enter Selection: rock

Player 1 Enter Selection: rocks

Player 1 Enter Selection: paper

Player 2 Enter Selection: scissors

Player 1 Enter Selection: scissors

Player 2 Enter Selection: rock

Player 1 Enter Selection: paper

Player 2Enter Selection: rock

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

Games Won

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

Player 1: 2

Player 2: 2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tie Games : 1

Invalid Games : 2

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

struct Player{
  String gesture;
  int wins{};
};

int main() {
  // TODO: (1) declare constant for the number of games to play
  
  // TOOO: (2) declare and initailize your other counters here (number of ties, invalid games)
  
  Player player_1;
  Player player_2;
  
  // TODO: (12) wrap in for-loop once working for 1 game. 
  
  // TODO: (3) get user input for player 1, commented out correct code for now, simulating with rock first
  player_1.gesture = "rock";
//   cout << "Player 1 enter selection: ";
//   getlline(cin, player_1.gesture);
  
  // TODO: (5) write a boolean proposition here, finish what it should be, notice how the name reads
  bool gesture_is_rock;
  bool gesture_is_paper;
  bool gesture_is_scissors;
  
  bool is_valid_gesture;
  
  // TDOO: (6) determine if player 1 entered invalid move
  if (!is_valid_gesture) {
    // TODO: (7) what should be done if invalid? How do you continue the loop
    
  }
  
  // TODO: (8) Do the exact same for Player 2 reusing the boolean variables 
  
  // TODO: (9) Determine if there was a tie, otherwise, there was a win
  bool is_tied_game;
  
  if (is_tied_game) {
    // TODO: (10) what should be done if tie?
    
  }
  else {
    // TODO: (11) consider how player one can win:
    bool player_1_wins;
    
    if (player_1_wins) {
    }
    else {
    }
  }
  
   // TODO: (4) Setup the way the output should be displayed based on the document

  return 0;
}

In: Computer Science

In this assignment, you will create a Java program to search recursively for a file in...

In this assignment, you will create a Java program to search recursively for a file in a directory.

• The program must take two command line parameters. First parameter is the folder to search for. The second parameter is the filename to look for, which may only be a partial name.

• If incorrect number of parameters are given, your program should print an error message and show the correct format.

• Your program must search recursively in the given directory for the files whose name contains the given filename. Once a match is found, your program should print the full path of the file, followed by a newline.

• You can implement everything in the main class. You need define a recursive method such as: public static search(File sourceFolder, String filename) For each folder in sourceFolder, you recursively call the method to search.

• A sample run of the program may look like this: //The following command line example searches any file with “Assignment” in its name

%java Assign7.Assignment6

C:\CIS 265 Assignment

C:\CIS 265\AS 2\Assignment2.class C:\CIS 265\AS 2\Assignment2.java C:\CIS 265\AS 3\CIS265\Assignment3.class C:\CIS 265\AS 3\CIS265\Assignment3.java C:\CIS 265\AS 4\Assignment4.gpj

Hi please tell me what to input exactly, thanks

In: Computer Science

Requirements: The company that needed the flowchart and pseudocode for calculating the final price of the...

Requirements: The company that needed the flowchart and pseudocode for calculating the final price of the TV set and sound bar has given you the responsibility of creating a program for that purpose. The requirements remain the same as those indicated for the flowchart: The program will be used to enter the price of the TV set and the sound bar, in that order. The place of residence will also be entered in order to calculate the sales tax Residents of New Jersey pay 6.625% sales tax Residents of New York City pay 8.875% sales tax. • Residents of New York State (outside New York City) pay 4.375% sales tax The place of residence will be entered as NJ, NYC or NYS After the calculation is performed, the final result will be displayed

In: Computer Science

In Python write a function with prototype “def wordfreq(filename = "somefile.txt"):” that will read a given...

In Python write a function with prototype “def wordfreq(filename = "somefile.txt"):” that will read a given file that contains words separated by spaces (perhaps multiple words on a line) and will create a dictionary whose keys are the words and the value is the number of times the word appears. Convert each word to lower case before processing.

In: Computer Science

Please solve me this question and send me the video clip how to do it This...

Please solve me this question and send me the video clip how to do it

This problem contains loops, sorting arrays, random generation, and variable matching.

Include an analysis (data requirements) and algorithm in your reply.

Write a “lottery engine” program to simulate drawing lottery numbers. You will draw 7 numbers, randomly selected from 1 to 16.

a) Allow the user to enter their own selection of numbers first,

Example numbers: 2 3 7 9 10 11 15

b) then run your “lottery engine” to select the “winning numbers”. Numbers are drawn randomly.

Use the clock as the seed value for your random function (Hint: use “srand(clock());” ).

c) Be sure to remove duplicate entries.

d) Print out the draw result as it was generated (unsorted), then sort the array and print out the sorted numbers.

Example output:

Draw unsorted: 2 12 16 14 7 13 1

Draw sorted: 1 2 7 12 13 14 16

e) Then print out the matching numbers selected by the user:

f) Also print the sorted user selection and draw results and matching numbers to a TXT file called “Results.txt”.

Example output

Draw sorted: 1 2 7 12 13 14 16

User’s sorted: 2 3 7 9 10 11 15

Matching numbers: 2 – 7

In: Computer Science

a) write a pseudocode to read three numbers and find the smallesr one b) write an...

a) write a pseudocode to read three numbers and find the smallesr one
b) write an algorithm for sane problem
c) draw flowchart for the same problem

In: Computer Science

data structures in the banker's algorithm is a vector of length m, where m is the...

data structures in the banker's algorithm is a vector of length m, where m is the number of resource types

a variant of the resource allocation graph used if all resources have only a single instance

system can allocate resources to each thread in some order and avoid a deadlock

assigned to its own resource

from thread Ti to resource Rj

directed graph used to describe a deadlock

deadlock avoidance algorithm used for resource allocation systems with multiple instances of each resource type

a sequence of thread where resources can be allocated without a deadlock

records whether each resource is free or allocated


from resource to thread

proves a set of methods to ensure that at last one of the necessary conditions cannot hold

indicates that a process may request a resource

requires that the operating system be given addition information in advance concerning which resource a thread will request

used by most operating systems


occurs when a thread continuously attempts an action that fails

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

Match Based on the above answers:-


Incidence of a lock

System table

Livelock

Resource allocation graph

Directed edge

Assignment edge

Claim edge

Available

Deadlock prevention

Deadlock avoidance

Do nothing about a deadlock

Safe state

Safe sequence

Baker’s algorithm

Wait-for graph

In: Computer Science

Given an integer named area which represents the area of a rectangle, write a function minPerimeter...

Given an integer named area which represents the area of a rectangle, write a function minPerimeter that calculates the minimum possible perimeter of the given rectangle, and prints the perimeter and the side lengths needed to achieve that minimum. The length of the sides of the rectangle are integer numbers. For example, given the integer area = 30, possible perimeters and side-lengths are: (1, 30), with a perimeter of 62 (2, 15), with a perimeter of 34 (3, 10), with a perimeter of 26 (5, 6), with a perimeter of 22 Thus, your function should print only the last line, since that is the minimum perimeter. Some example outputs:

>>>minPerimeter(30)

22 where rectangle sides are 5 and 6.

In: Computer Science

Scenario Congratulations! Your App Development Proposal has received approval after being shared with both your client...

Scenario

Congratulations! Your App Development Proposal has received approval after being shared with both your client and the mobile application development team at Mobile2App. It is now time to construct a UI based on your original proposal. You must supply the client with a complete UI design that is easy to understand and demonstrates a creative theme and layout for the finished application.

Directions

Open the Android Studio Layout Editor to begin creating the UI for your app. Be sure to use the Install Android Studio resource and the Build a Simple User Interface resource, both linked in the Supporting Materials section, to get started with this software. Throughout this project, continue to reference the App Development Proposal you completed in Project One while paying particular attention to the section on UI Design. Also be sure to let the Android Design and Quality Guidelines document, which is linked in the Supporting Materials section, guide your decisions.

Your completed UI should include all of the screens needed for your app to operate but the UI will not yet be functional. You will only be creating the UI components for this project as the supporting code will be completed in Project Three.

  1. Create UI with appropriate design elements to support a user logging in (1 screen). Your UI must include a login screen, that contains the following:
    • Fields for the user to provide a username and password
      • Note that the password element should be configured in a way that obscures any text that is typed into the field. This means the text will need to be visually converted into dots.
    • A button for the user to submit their username and password
    • A button for the user to create a new login if it is their first time using the application
      • Note that to simplify the account creation process, you can use the same login screen for this purpose. Create a button that will add the username and password into the database if it does not already exist.
    • Any other fields or elements that are necessary to make your application visually appealing, intuitive, and usable

In: Computer Science

Instructions Complete the program below. The program should be turned in as a .py file. Please...

Instructions

Complete the program below. The program should be turned in as a .py file. Please turn in the .py file itself (do not take a picture of it or copy/paste it into another program). Please also turn in the output for your program. The output should be in a different file. You may find the easiest way is to take a screenshot of your output. You can use the snipping tool on Windows or the grab tool on a Mac to take pictures of your output. You may want to put all of your output pictures in a single Word file.

Criteria for Success

Please view the rubric to ensure you are completing everything you need. You are required to use functions. In addition, make sure the output examples you turn in show a variety of test cases. You can create a test() function in your program to prove the majority of your code works.

Password Validator

When users create a new account on a website, they are often asked to create a new password. Many websites then test the password to make sure it is strong enough before allowing a user to save it. If it's not strong enough, the user needs to create a new password.  

In this program, you will ask a user for a username/password combination and test for password strength according to the following rules:

  • Must be at least 8 characters and less than 21 characters (20 characters is OK, 21 is not)
  • Must contain both an upper and lowercase letter
  • Must contain a digit (0-9)
  • Must contain a punctuation mark (!+.@$%*)
  • Must ONLY consist of letters (A-Z), (a-z), digits (0-9) and !+.@$*.

Your program will prompt for a username. Then, it will prompt for a password. Your program should check the password. If the password is OK, print "Good Password!" and end the program. If the password is NOT OK, print the appropriate message to the user. Continue reprompting until the user successfully picks a good password.

If there are multiple problems with the password, you only need to report one.

Consider: Is this the most user-friendly approach?

No. It's not. But it does seem some websites continue to hassle the user this way, while others let the user know up front what is expected... And give better error messages than these, often reincluding what is required. I prefer those sites. However, I want you to write the code that can give specific errors.

Obvious Password

Rule: If a password contains 1 or more of the following Strings (ignore case):

  • password
  • 1234
  • 111111
  • Qwerty123
  • Abcd99
  • football
  • dragon
  • letmein
  • iloveyou
  • admin
  • login
  • welcome
  • flower
  • zaq1
  • Password1

Message to user: Don't use common passwords

Too Short Password

Rule: Password must be at least 8 characters long

Message to user: Password must be at least 8 characters long

Too Long Password

Rule: Password must be less than 21 characters long

Message to user: Password must be less than 21 characters

Low Complexity Password

Rule: The password must contain at least 1 character each of:

  • lowercase letter
  • uppercase letter
  • digit
  • punctuation mark (!+.@$%*)

Message to user: Passwords must contain both upper and lower case letters, at least one digit and at least one punctuation mark (!+.@$%*)

Unrecognized Character

Rule: Your company's back-end systems don't like certain characters. Therefore, the password must only contain:

  • Letters (A-Z) or (a-z)
  • Digits (0-9)
  • Punctuation (!+.@$%*) (no parentheses)

Message to user: Password contains an Invalid Character

Other Issues

Rule: If the password has one of the following issues, alert the user of the issue and have them choose a new one.

  • Password contains the username (ignoring case)
  • Password is the same as the username spelled backwards (ignoring case)

Message to User: Passwords can't contain a variation of the username

Pig Latin Translator

Write a program that asks the user for a sentence and converts it to Pig Latin. The below explains how to convert to Pig Latin:

If the first letter is a vowel (a, e, i, o, u):

  • Add "way" to the end of the word.

If the first letter is a consonant (treat the letter "y" as a consonant):

  • Remove the first letter and place that letter at the end of the word. Then append the string "ay" to the end of the word

Words that have their first letter capitalized, should continue to have the (possibly new) first letter capitalized.

Sentences end with a period (.), an exclamation point (!) or a question mark (?). Make sure the punctuation continues to stay at the end of the sentence.

English Pig Latin
sleep leepsay
the hetay
python ythonpay
computer omputercay
pig igpay
Latin Atinlay
if ifway
other otherway
only onlyway
apple appleway

Sentences occassionally have other punctuation such as commas (,) and semicolons (;). Make sure these punctuation marks stay put.

For example:

Original sentence: Hello World!
Right: Ellohay orldway!
NOT: elloHay orld!Way

Original sentence: To be, or not to be?
Right: Otay ebay, orway otnay otay ebay?
NOT: oTay e,bay orway otay e?bay

You only have to deal with the 5 punctuation marks mentioned (. ! ? , ;)


PUTHON PROGRAM

In: Computer Science