In: Computer Science
Create a Square Class and Create a graphical representation of your Square class
- your class will have the following data fields: double width, String color.
- provide a no-args constructor.
- provide a constructor that creates a square with the specific width
- implement method getArea()
- implement method getPerimeter()
- implement method setColor().
- draw a UML diagram for your class
- write a test program that will create a square with the width 30, 40 and 50.
Display the width, area and perimeter of each of your squares.
In: Computer Science
Use Google to search for online storage services or cloud backup. Look for an article or post that describes available services for remote backups. List two services and locate additional information about each, including how to enroll, costs to use, known security risks or breaches and customer reviews. Find articles that describe how companies are adopting online storage services and locate statistics about how many currently are doing so as well as predictions. Have you ever used an online storage service for backup or data recovery? If so, describe the experience. Submit your findings in a brief 250 word essay. Identify at least one URL used as a research source.
In: Computer Science
C++ Programming.
Create a class hierarchy to be used in a university setting. The classes are as follows:
The base class isPerson. The class should have 3 data members: personID (integer), firstName(string), and lastName(string). The classshould also have a static data member called nextID which is used to assignanID numbertoeach object created(personID). All data members must be private.
Create the following member functions: Accessor functions to allow access to first name and last name (updates and retrieval). These functions should be public. Create a getID function to retrieve the personID of the person. This function should be public. The user oftheclassor any derived class should not have the ability to update personID. Create a constructor with two arguments(first name and last name) with default values.
Create a public member function Print to display information stored in the object. Make this class an abstract class. Create theStudent class as a derived class from the Person class. This class should have two additional data members to keep track of astudent’s GPA (float) and admission term (string –eg. Fall 2019). Create public accessor functions to allow access to the GPA and admission term. The setGPA function should return true if the value of the GPA is between 0 and 4.0(inclusive) and false otherwise. Set the GPA to zero if an invalid value is provided. Override the function Print to print the student information. Create a constructor that takes in four argumentswith default values(first name, last name, admission term, and GPA). Create the Faculty class as a derived class from the Person class. This class should have one additional data member to keep track of the yearthe faculty was hired(string –eg. 2019 ) Create a public accessor functionto allowaccess to the hire year. Override the function Print to print the faculty information. Create a constructor that takes in three argumentswith default values(first name, last name, hire year).
After defining the classes in this hierarchy, write a program that creates objects of each class and tests their member functions. Make sure you include the preprocessor directives (#ifndef, #define, #endif) to prevent a header file from being included (#include) multiple times. Separate the class interface from the class implementation.
Output Sample:
Faculty First Name: John
Faculty Last Name:Smith
Faculty ID:5
Faculty Hire Year:2019
******************************************************
******************************************************
Student First Name: Sarah
Student Last Name: Smith
Student ID: 3
Student GPA: 3.75
Student Admit Term: Fall 2019
In: Computer Science
need to add this withdrawal and balance function to the script below:
Calculate the Balance - Withdrawal
If the action is Withdrawal ‘W’, use the withdrawal function to remove funds from the account
Hint – The formatter for a float value in Python is %f. With the formatter %.2f, you format the float to have 2 decimal places. For example:
print("Account balance: $%.2f" % account_balance)
Withdrawal Information
Withdraw Input
userchoice = input ("What would you like to do?\n") userchoice = 'W' withdrawal_amount = 100
Withdraw Output
What would you like to do? How much would you like to withdraw today? Withdrawal amount was $100, current balance is $600.25
ATM Summary Feedback Available
If you would like our automated system to review your code and give you some feedback on your project before you submit for a grade, just click the Help Me! button below.
Help Me!
withdrawal_amount is greater than your account balance of account_balance
Ensure you display the withdrawal amount and the account balance with the '$' and two decimal points.Withdrawal amount was withdrawal_amount, current balance is account_balance
Need to add the Withdrawal amount to this program:
import sys # importing the sys library
# account balance
account_balance = float(500.25)
# PPrint the balance
# This is a custom function, it returns the current balance upto 2 decimal places
def printbalance():
print('Your current balance:')
return account_balance
# the function for deposit
# This is a custom function
def deposit():
# takes in input for deposit amount
deposit_amount = float(
input("How much would you like to deposit today?\n"))
balance = account_balance + deposit_amount # calculates balance
print("Deposit was $%.2f, current balance is $%.2f" %
(deposit_amount, balance)) # prints out the balance
# function for withdraw
# this is a custom function
def withdraw():
# takes in the withdraw amount
withdraw_amount = float(input("Enter amount to withdraw"))
if(withdraw_amount > account_balance): # checks whether the amount is more than balance or not
print("$%2f is greater than account balance $%2f\n" %
(withdraw_amount, account_balance)) # if yes then
else:
balance = account_balance - withdraw_amount
print("$%2f was withdrawn, current balance is $%2f" %
(withdraw_amount, balance))
# User Input goes here, use if/else conditional statement to call function based on user input
userchoice = input("What would you like to do?\n")
if (userchoice == 'D'):
# here deposit function is called
deposit()
elif userchoice == 'W':
# here withdraw function is called
withdraw()
elif userchoice == 'B':
# here printbalance function is called
balance = printbalance()
print('{:.2f}'.format(balance))
else:
# it ends the program execution
sys.exit()
In: Computer Science
Suggest an appropriate project methodology that might be used for development of the following computer systems. Provide proper justification of your choice.
In: Computer Science
In: Computer Science
Distinguish between logical models and physical models. How is each useful?
In: Computer Science
Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following:
Create an input file with your original three-or-more items and add at least three new items, for a total of at least six items.
Copy your program from Part 1 and modify it to do the following:
It will be interesting to see if your original dictionary is reversible. If you invert it twice, do you get the original dictionary back?
Include the following in your Learning Journal submission:
Learning Journal Unit 7
Create a Python dictionary where the value is a list . The key can be whatever type you want.
Design the dictionary so that it could be useful for something meaningful to you. Create at least three different items in it. Invent the dictionary yourself. Do not copy the design or items from some other source.
Next consider the invert_dict function from Section 11.5 of your textbook.
# From Section 11.5 of:
# Downey, A. (2015). Think Python: How to think like a computer
scientist . Needham, Massachusetts: Green Tree Press.
definvert_dict(d):
inverse = dict()
for key in d:
val = d[key]
if val not in inverse:
inverse[val] = [key]
else:
inverse[val].append(key)
return inverse
Modify this function so that it can invert your dictionary. In particular, the function will need to turn each of the list items into separate keys in the inverted dictionary.
Run your modified invert_dict function on your dictionary. Print the original dictionary and the inverted one.
Include your Python program and the output in your Learning Journal submission.
Describe what is useful about your dictionary. Then describe whether the inverted dictionary is useful or meaningful, and why.
In: Computer Science
Letter Separated Numbers (C++)
I've encountered a corrupted database that has a series of important numbers, but instead of being separated by a space, the spaces have been randomly changed in alphabetic characters. Write a function named "my_numbers" that can take a string like "18y5638b-78" and return a vector of ints {18, 5638, -78}.
Thanks!
In: Computer Science
Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Create and use a Point class to represent the points in each shape. Make the hierarchy as deep ( i.e., as many levels ) as possible. Specify the instance variables and methods for each class. The private instances variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. Write a program that instantiates objects of your classes and outputs each object’s area (except Quadrilateral).
In: Computer Science
Using java:
Implement a basic doubly-linked list that implements a priority system sorting the elements that are inserted. Sort based on the speed of the warrior.
Driver code:
public class LinkedListDriver {
public static void main(String[] args) {
LinkedList list = new SortedDoublyLinkedList();
System.out.println(list);
Warrior krogg = new Warrior("Krogg", 30, 50, 200);
list.insert(krogg);
System.out.println(list);
Warrior gurkh = new Warrior("Gurkh", 40, 45, 180);
list.insert(gurkh);
System.out.println(list);
Warrior brynn = new Warrior("Brynn", 45, 40, 190);
list.insert(brynn);
System.out.println(list);
Warrior dolf = new Warrior("Dolf", 20, 65, 210);
list.insert(dolf);
System.out.println(list);
Warrior zuni = new Warrior("Zuni", 50, 35, 170);
list.insert(zuni);
System.out.println(list);
}
}
Warrior class:
public class Warrior {
private String name;
private int speed;
private int strength;
private int hp;
public Warrior(String name, int speed, int str, int hp) {
this.name = name;
this.speed = speed;
this.strength = str;
this.hp = hp;
}
public String getName() { return this.name; }
public int getSpeed() { return this.speed; }
public int getStrength() { return this.strength; }
public int getHp() { return this.hp; }
public String toString() { return this.name + "(" +
this.speed + ")"; }
}
Class that needs to be done:
interface LinkedList {
void insert(Warrior warrior);
String toString();
}
Expected output:
[ Zuni(50) Brynn(45) Gurkh(40) Krogg(30) Dolf(20) ]
In: Computer Science
Design a universal hashing scheme using matrix operations.
In: Computer Science
A survey of chewing gum preferences was given to baseball players. On the survey form, fruit was checked a total of 21 times; spearmint was checked a total of 26 times; 12 players checked both; 7 surveys had nothing checked. How many players were surveyed?
In: Computer Science
2. Consider the following relations:
Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum)
Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN)
Medicine(TradeName, UnitPrice, GenericFlag)
Prescription(Prescription Id, Date, Doctor_SSN, Patient_SSN)
Prescription_Medicine(Prescription Id, TradeName, NumOfUnits)
Note: The Medicine relation has attributes, trade name, unit price, and whether or not the medicine is generic (True or False).
a. Determine the functional dependencies that exist in each table given above.
In: Computer Science