Questions
(Python code please) Of a Guessing game(1-10) with a limited amount of guesses (5)

(Python code please) Of a Guessing game(1-10) with a limited amount of guesses (5)

In: Computer Science

Please Provide Detailed Answer. Prove that a PDA that has access to two stacks is as...

Please Provide Detailed Answer. Prove that a PDA that has access to two stacks is as powerful as a Turing Machine. Such a PDA has labels on the transition arrows of the form (a, α, β → α' , β' ), meaning that read an a from the input, pop an α from the first stack, β from the second stack, and push α' on the first stack, and β' on the second stack.

In: Computer Science

Consider the following relational schema and set of functional dependencies. S(A,B,C,D,E,F,G) D → E E →...

Consider the following relational schema and set of functional dependencies.

S(A,B,C,D,E,F,G)

D → E

E → B

C → FG

BE → AC

Is the decomposition of S into S1(E,G,F) and S2(A,B,C,D,G) a lossless join decomposition?

Choose one of the following queries as your answer: SELECT ’lossy’; SELECT ’lossless’;

In: Computer Science

Assume a relation X(A,B,C) defined by the following statement: CREATE TABLE X (A int, B int,...

Assume a relation X(A,B,C) defined by the following statement:

CREATE TABLE X (A int, B int, C int);

The relation is currently empty. You have to insert exactly 3 tuples into the relation, without duplicates, to create a data instance in which the functional dependency A → BC holds and the functional dependencies B → C and C → B do not hold.

Submit your 3 insert statements

In: Computer Science

. Use a validation loop to prompt for and get from the user a string that...

. Use a validation loop to prompt for and get from the user a string that is up to ten characters in length. Create value function encodedString that takes the string as input and returns the equivalent encoded string. Start with an empty encoded string. Use a for loop to encode each character of the input string. Use the following algorithm to encode a character and append the encoded character to the encoded string:

In: Computer Science

Program Description A local company has requested a program to calculate the cost of different hot...

Program Description

A local company has requested a program to calculate the cost of different hot tubs that it sells. Use the following instructions to code the program:

File 1 - HotTubLastname.java

  • Write a class that will hold fields for the following:
    • The model of the hot tub
    • The hot tub’s feature package (can be Basic or Premium)
    • The hot tub’s length (in inches)
    • The hot tub’s width (in inches)
    • The hot tub’s depth (in inches)
  • The class should also contain the following methods:
    • A constructor that doesn’t accept arguments
    • A constructor that accepts arguments for each field.
    • Appropriate accessor and mutator methods (i.e., setters and getters).
    • A method named getCapacity that accepts no arguments and calculates and returns the capacity (in gallons) of the hot tub.

The capacity of the hot tub can be calculated by using the following formula:

Capacity in gallons = (Length * Width * Depth) / 1728 * 4.8

    • A method named getPrice that accepts no arguments and calculates and returns the price of the hot tub based on the following table:

Hot Tub Capacity

Package

Cost Per Gallon

Less than 350 gallons

Basic

$5.00

Less than 350 gallons

Premium

$6.50

350 but not more than 500 gallons

Basic

$6.00

350 but not more than 500 gallons

Premium

$8.00

Over 500 gallons

Basic

$7.50

Over 500 gallons

Premium

$10.00


Price = Cost Per Gallon * Capacity

File 2 - DemoLastname.java

  • Write a program that demonstrates the class and calculates the cost of hot tubs. The program should ask the user for the following:
    • The model of the hot tub
    • The hot tub’s feature package (can be Basic or Premium)
    • The hot tub’s length (in inches). The program should not accept a number less than 60 for the length.
    • The hot tub’s width (in inches). The program should not accept a number less than 60 for the width.
    • The hot tub’s depth (in inches). The program should not accept a number less than 30 for the depth.
  • The program should prompt the user for all the data necessary to fully initialize the objects. IMPORTANT: Store your objects in a container that will automatically expand as objects are added.
  • The program should continue allowing the user to input information until the user indicates to stop (see sample input on page 3). Note: The program should accept lower or upper case responses to this question.
  • After the user indicates that they wish to stop, the program should output the information for each hot tub.
    • The capacity of the hot tub should be formatted to two decimal places.
    • The price of the hot tub should be formatted as currency to two decimal places and include a comma in the thousands place.
  • After the program outputs the information for each hot tub, it should output the total cost of all of the hot tubs.
  • The program should display the input and output as shown in the provided sample output (Note: this includes blank lines).

In: Computer Science

Draw state diagrams of the control software for: ■ An automatic washing machine that has different...

Draw state diagrams of the control software for:
■ An automatic washing machine that has different programs for different types of
clothes

In: Computer Science

Python What are the advantages and disadvantages of solving a problem that can be broken down...

Python

What are the advantages and disadvantages of solving a problem that can be broken down into repetitive tasks with recursion as opposed to a loop? Explain your answer.

Sometimes Graphical User Interfaces can be too cluttered. What is a good general rule of thumb for the number of elements on a page within a Graphical User Interface? Explain your answer.

In: Computer Science

Ms. Asma Ahmed is the new director of the Al-Ekra University library. Your team has been...

Ms. Asma Ahmed is the new director of the Al-Ekra University library. Your team has been contacted by Ms. Asma to develop a software system for the library only. She has prepared a description of some basic functions of the library loan system currently done manually. Ms. Asma wants an automatic library system that should work as described below: “The library loan system that we have at present is mostly manual. The library has three types of items for loan to its members: Book, DVD, and Magazine. Each item is identified with a unique call number of six digit long. The item has also a title and year of publication/production. Not all items are for loan. Some items are only for the use inside the library. For a book, 4 weeks; for a DVD, one week; and for a magazine 2 weeks loan is granted if the item is available for loan. A member can borrow maximum 5 items. The library maintains three different file systems: Membership, Item, and Loan. The university has also a separate software system called UniSys that deals with students and staff. The system has three major components: Staff/Student data, Registration data, and Course data. However, our library system needs data from UniSys to check the validity of the membership of the library. The university has another software system that deals with finance and payments, called FinSys which is also independent but communicates with other systems in the university. It has three components: Financial account of the staff/student, Salary, and Expenditure. Every person at Al-Ekra University has a FinSys account called Fin_Account. The information on the salary of the staff and the tuition fee of the student are stored here. We now want a library system that can provide the following functions. The member of the library can only borrow items from the library. The person must be either staff or student of Al-Ekra University. The person first submits an online application form. The forms include the name and address of the person, and the Fin_Account of the person with Al-Ekra University. A library administrative staff is immediately informed by the system that an application has been submitted. The admin staff first checks the application, and provides input if needed. The system saves the updated information of the application, and then contacts UniSys to get the confirmation that the applicant is either staff or student. Once the library system gets the feedback from UniSys, it records the feedback. If the person is a member of the university, the application is preliminary accepted; otherwise the application is rejected without further processing. The library system then requests FinSys to transfer QR. 500 from the applicant’s Fin_Account to the library. Once the money is transferred, the system creates a library membership account, and deposits the money in this account. After transferring the money to the library system, FinSys records in the applicant’s Fin_Account that QR. 500 has been transferred to library. Finally, it produces a membership card, and assigns a unique membership number. The system finally sends the membership card to the member. If FinSys does not transfer money, the system generates an error message to enter valid Fin_Account. Every team member MUST read this document carefully Page 2 In order to borrow an item from the library, a member first enters the membership card into a card reader of the library. The system retrieves the membership details and contacts the university system UniSys to find if the member is an active staff or student. If not, the system does not allow the member to borrow any item from the library and terminates the function. Otherwise, the system asks the member to place the item in the scanner. Once the member does this, the system gets the item details and its type. It also checks if the item is available for loan. The system also finds out the total items already borrowed but not returned. If the item is available for loan, and the total item borrowed but not returned is less than 5, it makes a loan for the member. The item is included in the membership account with the borrowing date and due date for return. The system then increments the total borrowed items by 1, and it makes the item unavailable for other members. The system also decrements the total items reserved of the member if the item was reserved by the member. The member has also choice to request for extended loan time for one more week. If the item was not reserved, one more week is added with the original return date. Finally, it creates a receipt of the loan, and releases the security code of the item. The receipt includes information such as membership number, item call number, loan date, and return date. A member can return a borrowed item to the library by scanning the item into the system that finds the loan details. It then checks the due date. If the due date already passed, it calculates the fine based on number late days. The system updates the member account with the fine. It then makes the item available and sets the security code of the item. The system decrements the total item borrowed by 1. It then creates a receipt of the return. The members can also extend the return date of an item if not reserved by other members. The member first inserts the membership card into the card reader. The system retrieves the list of all currently borrowed items. The member then selects the item that he/she wants to be extended. The system finds the current return date. If the return date has already passed, no extension is possible. An extension is only possible if the request is made before the return date. It also checks if the item has already been reserved. If reserved by other, the return date cannot be extended, otherwise one week extension is made. The system updates the member account with the new return date. It prepares a receipt with the new return date. A member can reserve an item if it is currently on loan with other member. The member first enters the card into the card reader. The system finds the membership details. It checks the total number of current reserved items. It the member has already reserved 3 items, no more reservation request is possible. The system asks for the call number of the item he/she wants to reserve. The system retrieves the item details once the member enters the call number of the item. If already reserved by other, it cannot be reserved by anyone. If not, the item is reserved under the member account, and increments the total reserved item by 1. The system confirms the reservation to the member. Every day at 10 am, the library system automatically checks if any item was not returned after 10 days of the due date. The system generates a list of such items and alerts the admin staff with the list. The staff then enters the call number of each item into the system which finds the loan details. It changes the status of the item as ‘lost’. The system deducts QR. 500 from the deposit money as a fine from the member account. It then requests FinSys with the Fin_Account of the applicant to transfer QR. 500 to the library. FinSys forwards the transfer information to the library that receives the advice and updates the member account with the deposit money. The member is informed about the lost item. The system should know which item was borrowed by which member, borrowing date, the return date, if the item was returned and when. It can also find out which item was lost and by which member, how many items were borrowed by one member, which item was borrowed by which members so far, etc. " Page 3 Ms. Asma wants that the managing of the above activities of the library should be automated as much as possible. There will be also possibility that the administrative staff can generate summary report of loans, returns, fines, etc. At this stage, she wants you to analysis ONLY the functionalities of the library system. She also warns you that you should not analyze any functionality of other systems in this phase. You need to define the system boundary carefully.

Prepare design sequence diagrams for all 3 use cases proposed, ( return item,reserve item, generate sum mary report)

In: Computer Science

Please No Plagiarism must be in your own 500 words There is much discussion regarding Data...

Please No Plagiarism must be in your own 500 words

There is much discussion regarding Data Analytics and Data Mining. Sometimes these terms are used synonymously but there is a difference.  What is the difference between Data Analytics vs Data Mining? Please provide an example of how each is used.

In: Computer Science

In java, (include javadoc comments for each method, please use ArrayList, not Array, and ensure that...

In java, (include javadoc comments for each method, please use ArrayList, not Array, and ensure that the program compiles).
design a class named Contact that has fields for a person’s name, phone number and email address. The class should have a no-arg constructor and a constructor that takes in all fields, appropriate setter and getter methods.

Then, write a program that creates at least five Contact objects and stores them in an ArrayList. In the program create a method, that will display each object in the ArrayList. Call the method to demonstrate that it works.

In: Computer Science

Write a C program to run on ocelot which will either set or clear a single...

Write a C program to run on ocelot which will either set or clear a single bit in a number entered by the user using the binary representation of the number. The user should input the original integer value between 1 and 1000 inclusive using a scanf. Use an unsigned integer type. Output is to the screen. You must use only bitwise operators for this program. You can shift bits and or use the logical bitwise operators.

For this assignment give the user directions asking them to enter the integer and then ask the user if he or she wants to clear or set a bit. Then ask the user which bit to set or clear. That can be a number between 0 and 31. Prompt the user for what should be entered each time. Be sure to validate all user input so the program cannot be crashed. After completing the operation ask the user if they want to do the entire operation again. The user would enter Y or y to do it again. This would be the entire operation from entering the first integer.

You do not need to use getopt for this program since there are no command line arguments.

• If the user enters a 1 as the initial value and a 0 for the bit to clear the result would be 0.

• If the user enters a 1 as the initial value and a 0 for the bit to set the result would be 1.

• If the user enters a 10 as the initial value and a 1 for the bit to clear then the result would be 8.

• If the user enters a 10 as the initial value and a 1 for the bit to set then the result would be 10.

• If the user enters a 10 as the initial value and a 2 for the bit to clear then the result would be 10.

• If the user enters a 10 as the initial value and a 2 for the bit to set then the result would be 14.

Output for each operation should be easy to read giving the number before the switch and then the decimal number after the switch. No other output should be included.

The program should compile to create an executable called bitops.

• Test the program with the following commands:

                  - bitops

                              ▪ enter 10 as the initial value and a 2 for the bit to clear

                  - bitops

                              ▪ enter 10 as the initial value and a 1 for the bit to set

• Take a screenshot of the screen showing the output on ocelot. Name it FirstNameLastName.png or .jpg.

Submit your source file, the screenshot and your Makefile in one zip file called FirstnameLastnameL4.zip to the assignment dropbox in Canvas. If the program does not compile and do something useful when it runs it will not earn any credit

In: Computer Science

in java language. There are three classes for the project, and two inner classes defined in...

in java language.

There are three classes for the project, and two inner classes defined in the Cuboid class.

Create the following classes:

•   Shape. It’s an abstract class with two abstract methods, area and perimeter.
•   Rectangle. It’s a concrete class that extends Shape. Implement area() and perimeter(). Implement the compareTo(object) method to sort rectangles by area in ascending order.
•   Cuboid. It’s a concrete class that extends Rectangle. A cuboid is a 3D rectangle. The shape has a third dimension, Depth. Override the area() method to compute the surface area of the object and implement new method volume(). The perimeter method is invalid in this context. The best way to handle this is to throw an exception called “UnsupportedOperationException”. If perimeter() is called, throw this exception.
•   SortByArea and SortByVolume are two classes defined as attributes of the Cuboid class. If you want to sort, the easiest way is to implement the compareto() method. If you want to sort more than one way, you must implement multiple comparators. Implement these methods so they are sorting by area in ascending order and volume in ascending order.


Complete the following unit tests:
•   Rectangle
o   Test Construction
o   Test getter / setter methods
o   Test area()
o   Test perimeter
o   Test compareTo(Object), ensuring rectangles are being sorted correctly (2x2 sorts < 4x6, for example)
•   Cuboid
o   Test Construction
o   Test getter / setter methods.
o   Test area()
o   Test perimeter
o   Test SortByArea
o   Test SortByVolume

In: Computer Science

Considering the power of the attackers in KPA, CPA, and CCA assumptions(given in the lecture slides...

Considering the power of the attackers in KPA, CPA, and CCA assumptions(given in the lecture slides of week 1a), define the KPA-Game, CPA-Game, CCA-Game and the associated computational indistinguishable definition under these attack games.

Note, computational indistinguishability under CPA-Game is the minimum requirement for message confidentiality in real applications. And once again, we write computational indistinguishable under KPA-Game, CPA-Game, CCA-Game as KPA-IND, CPA-IND, and CCA-IND, respectively

In: Computer Science

JAVA public class StringQueue {    //You may NOT add any more fields to this class....

JAVA

public class StringQueue {
   //You may NOT add any more fields to this class.
   private Stack<String> stack1;
   private Stack<String> stack2;

   /**
   * Initializes an empty queue.
   */
   public StringQueue() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Returns true if this queue is empty.
   *
   * @return {@code true} if this queue is empty; {@code false} otherwise
   */
   public boolean isEmpty() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Returns the number of items in this queue.
   *
   * @return the number of items in this queue
   */
   public int size() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }


   /**
   * Adds the item to this queue.
   *
   * @param item the item to add
   */
   public void enqueue(String item) {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Removes and returns the item on this queue that was least recently added.
   *
   * @return the item on this queue that was least recently added
   * @throws NoSuchElementException if the queue is empty
   */
   public String dequeue() throws NoSuchElementException {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

In: Computer Science