Declare a Python list named famfri with the first names of five friends or family members.
Lists and tuples are examples of what kind of Python construct?
Write a Python for loop that prints the names of the friends or family, one per line, without referencing a range or any literal numeric values.
Write Python code examples of statements to remove the name at
position 2 from the list in the first problem, and to remove one of
the remaining names by referencing that name.
In: Computer Science
A company would like to implement its inventory of smartphones as a doubly linked list, called
MobileList.
1. Write a Mobile node node class, called MobileNode, to hold the following information about a
smartphone:
• code (as a String)
• brand (as a String)
• model (as a String)
• price (as int)
MobileNode should have constructors and methods (getters, setters, and toString()) to manage
the above information as well as the link to next and previous nodes in the list.
2. Write the MobileList class to hold objects of the class MobileNode. This class should define:
• Two instance variables first and last to keep the reference (address) of the first and last
nodes of the list.
• The MobileList class should implement the following interface:
public interface MList {
public boolean isEmpty();
// returns true if the list is empty, false otherwise
public int size();
// returns the number of items in the list
public MobileNode getNodeAt(int index);
//returns the MobileNode object at the specified index
public void addFirst(MobileNode item);
// adds a Mobile node at the front of the list
public void addLast(MobileNode item);
// adds a Mobile node at the end of the list
public void addAt(int index, MobileNode item);
// adds a Mobile node to the list at the given index
public String removeAt(int index);
// removes the Mobile node from the list that has the given
// index
public String remove(MobileNode item);
// removes the first item in the list whose data equals
// the given item data
public MobileNode[] searchPriceGreaterThan(int p);
//search and return an array of the set of MobileNode items
//having a price greater than p
public double averagePrice();
// return the average price of the mobile nodes in the list
public double averageBrandPrice(String brand);
// return the average price of the mobile nodes in the list
// from the brand given as a parameter (e.g., “Samsung” or
// “samsung”)
@Override
public String toString();
// implement a toString() method that prints the list in the
// format:
//[ size: the_size_of_the_list
// Mobile node1,
// Mobile node2,
//.... ]
}
3. Write a TestMobileList class to test the class MobileList. This class should have a main method
in which you perform the following actions:
• Create a MobileList object,
• Insert 10 MobileNode objects into the created list (from some brands like “Apple”,
“Samsung”, “Huwaei”, “Sony”),
• Print the content of your list,
• Find out in the list the items that have a price greater than 3000. Print them out.
• Remove the first element of the list
• Remove the item at index 3
• Print again the content of your ist,
• Print out the average price of all mobiles in the list
• Print out the average price of all mobiles in the list from “Apple”.
For each operation above, print a small message that describes the operation you are doing.
For example:
System.out.println(“Insertion of 10 Mobile nodes in the list”);
In: Computer Science
Valid or Invalid Password Deliverables
• Complete one document that shows your planning (IPO Chart). Include in it Input, Processing, Output, Variables, Algorithm, Testing Conditions
• Complete the code for your method and test it then upload for grading
Requirements: Write a Java method to check whether a string is a valid password.
Password rules: A password must have at least ten characters.
A password consists of only letters and digits.
A password must contain at least two digits.
Expected Output:
1. A password must have at least eight characters.
2. A password consists of only letters and digits.
3. A password must contain at least two digits Input a password (You are agreeing to the above Terms and Conditions.): abcd1234 Password is valid: abcd1234
In: Computer Science
Language Javascript and HTML
Google Treemap Chart is not displaying information and I don't know why.
Index.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['treemap']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['State', 'Region', 'Housing', 'Utilities'],
['Global', null, 0, 0],
['AK', 'Southeast', 150, 167],
['AL', 'Southeast', 79, 99],
['AR', 'Southeast', 83, 92],
['AZ', 'Southwest', 110, 95],
['CA', 'West', 184, 107],
['CO)', 'West', 103, 94],
['CT', 'Northeast', 161, 122],
['DC', 'Northeast', 248, 103],
['DE', 'Northeast', 101, 122],
['FL', 'Southeast', 92, 99],
['GA', 'Southeast', 80, 98],
['HI', 'West', 236, 167],
['IA', 'Midwest', 92, 90],
['ID', 'West', 79, 93],
['IL', 'Midwest', 89, 102],
['IN', 'Midwest', 82, 87],
['KS', 'Midwest', 85, 87],
['KY', 'Southeast', 78, 95],
['LA', 'Southeast', 91, 84],
['MA', 'Northeast', 130, 120],
['MD', 'Northeast', 175, 109],
['ME', 'Northeast', 133, 109],
['MI', 'Midwest', 86, 103],
['MN', 'Midwest', 96, 101],
['MO', 'Midwest', 80, 103],
['MS', 'Southeast', 83, 108],
['MT', 'West', 97, 88],
['NC', 'Southeast', 83, 98],
['ND', 'Midwest', 100, 82]
['NE', 'Midwest', 82, 99]
['NH', 'Northeast', 128, 125]
['NJ', 'Northeast', 166, 135]
['NM', 'Southwest', 97, 92]
['NV', 'West', 87, 84]
['NY', 'Northeast', 188, 117]
['OH', 'Midwest', 83, 97]
['OK', 'Southwest', 80, 93]
['OR', 'West', 117, 99]
['PA', 'Northeast', 98, 109]
['RI', 'Northeast', 132, 124]
['SC', 'Southeast', 83, 107]
['SD', 'Midwest', 98, 94]
['TN', 'Southeast', 78, 89]
['TX', 'Southwest', 83, 96]
['UT', 'West', 82, 85]
['VA', 'Southeast', 93, 97]
['VT', 'Northeast', 138, 128]
['WA', 'West', 102, 85]
['WI', 'Midwest', 91, 104]
['WV', 'Southeast', 86, 100]
['WY', 'West', 117, 95]
]);
tree = new google.visualization.TreeMap(document.getElementById('chart_div'));
tree.draw(data, {
minColor: '#f00',
midColor: '#ddd',
maxColor: '#0d0',
headerHeight: 15,
fontColor: 'black',
showScale: true
});
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
In: Computer Science
Write a function in python that accepts a sentence as the argument 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 NIGHTPIG LATIN: IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY. Please, I want the coding indented and then the results screen shot.
In: Computer Science
Below is an invoice sent out by MegaCorp.
Order ID |
Order |
Customer |
Customer |
Customer |
Product |
Product |
Product |
Product |
Ordered |
Date |
Num |
Name |
Address |
ID |
Description |
Finish |
Standard Price |
Quantity |
|
1006 |
10/24/2018 |
2 |
HugeCorp |
Chicago, IL |
7 |
Widgets |
Platinum |
800 |
2 |
8 |
Widgets |
Chrome |
790 |
4 |
|||||
5 |
Wadgets |
Cherry |
325 |
2 |
|||||
4 |
Scaffolding |
Silver |
650 |
1 |
|||||
1007 |
10/25/2018 |
6 |
LittleCorp |
Edwardsville, IL |
7 |
Widgets |
Platinum |
800 |
1 |
11 |
Ladder |
Silver |
275 |
3 |
|||||
1008 |
10/26/2018 |
2 |
Huge Corp |
Chicago, IL |
5 |
Wadgets |
Cherry |
325 |
2 |
4 |
Scaffolding |
Silver |
650 |
1 |
STEP 1:
Convert the above to 1NF
STEP 2:
Consider the following functional dependencies of the invoice data:
OrderID à OrderDate, CustomerNum, CustomerName, CustomerAddress
ProductID à ProductDescription, ProductFinish, ProductStandardPrice
STEP 3:
Convert your 1NF table to 2NF. (i.e., look only at non-key attributes that are dependent on a single PK)
A relation is in 2NF if it contains no partial functional dependencies.
STEP 4:
Now, you’ve realized there are some additional functional dependencies:
CustomerNum à CustomerName, CustomerAddress
Convert your 2NF relations to 3NF based on the dependencies you just received.
In: Computer Science
Explain attacking mechanisms (e.g., step by step procedures or phase by phase: Preparation, Initial Intrusion, Expansion, Persistence, Search and Exfiltration, Cleanup) of GhostNet in detail for a given real case (identified by yourself)
(Hints: You should focus on the procedures of the attacking mechanism. Explain the following steps in detail: Preparation, Initial Intrusion, Expansion, Persistence, Search and Exfiltration, Cleanup)
In: Computer Science
my question hasnt been answered yet. So, posting it again.
Follow program instructions carefully. spacing is important.
You are to write a class called Point – this will represent a geometric point in a Cartesian plane (but x and y should be ints). Point should have the following:
Data:
Constructors:
throw new IllegalArgumentException(<”your meaningful String here”>);
If it is OK, the it should initialize the data (of the new instance being created) to be the same as the Point that was received.
Methods:
public class Point implements PointInterface
When your Point.java compiles, Java will expect all methods in the interface to be implemented and will give a compiler error if they are missing. The compiler error will read “class Point is not abstract and does not implement method <the missing method>”.
You can actually copy the PointInterface methods definitions into your Point class so it will have the comments and the method headers. If you do this, be sure to take out the ; in the method headers or you will get a “missing method body” syntax error when compiling…
Piece of the code:
//This is the interface for a Point class (which will represent a 2-dimensional Point)
public interface PointInterface
{
// toString
// returns a String
representing this instance in the form (x,y) (WITHOUT a space after
the ,)
public String toString();
// distanceTo
// throws a new
IllegalArgumentException(<your descriptive String> if null is
received
// returns the distance
from this Point to the Point that was received
// NOTE: there is a
static method in the Math class called hypot can be useful for this
method
public double distanceTo(Point otherPoint);
//equals - returns true if it is equal to what is
received (as an Object)
public boolean equals(Object obj);
// inQuadrant
//
returns true if this Point is in the quadrant specified
//
throws a new IllegalArgumentException if the quadrant is out of
range (not 1-4)
public boolean inQuadrant(int quadrant);
// translate
// changes this Point's
x and y value by the what is received (thus "translating" it)
// returns
nothing
public void translate(int xMove, int yMove);
// onXAxis
// returns true if this
Point is on the x-axis
public boolean onXAxis();
// onYAxis
// returns true if this
Point is to the on the y-axis
public boolean onYAxis();
//=============================================
// The method definitions below are
commented out and
// do NOT have to be implemented
//
//=============================================
// halfwayTo
// throws a new
IllegalArgumentException(<your descriptive String> if null is
received
// returns a new Point
which is halfway to the Point that is received
//public Point halfwayTo(Point another);
// slopeTo
// throws a new
IllegalArgumentException(<your descriptive String> if null is
received
// returns the slope
between this Point and the one that is received.
// since the slope is (changeInY/changeInX), then
first check to see if changeInX is 0
//
if so, then return Double.POSITIVE_INFINITY; (since the denominator
is 0)
//public double slopeTo(Point anotherPoint)
}
In: Computer Science
When you are developing and implementing a network, one of the primary concerns is controlling and monitoring traffic through the network. How can you effectively utilize a firewall on the network? Also, software vs. hardware - what are the advantages and disadvantages of each?
In: Computer Science
Design a security service that provides data integrity, data confidentiality and nonrepudiation using public-key cryptography in a two-party communication system over an insecure channel.
In: Computer Science
DO NOT ANSWER THIS QUESTION[Write a program that the owner of Chica Chic could use to store data about her inventory in a text file. The program should prompt her to input the name, cost price, and quantity of each item of inventory. Each of these three data has to be written to its own line in the file. The program should loop to enable any number of inventory items to be stored and end when the item name is left blank (see Sample Output. User inputs are shown in blue). The program should end by closing the file and printing a file status message. Sample Output Enter the name of the inventory item or ENTER to quit tops Enter the cost price of this item 24.99 Enter the quantity in stock of this item 10 A record was written to file Enter the name of the inventory item or ENTER to quit shorts Enter the cost price of this item 29.95 Enter the quantity in stock of this item 12 A record was written to file Enter the name of the inventory item or ENTER to quit sandals Enter the cost price of this item 19.79 Enter the quantity in stock of this item 8 A record was written to file Enter the name of the inventory item or ENTER to quit The file was created successfully and closed] DO NOT ANSWER THIS QUESTON
Now write another program that reads her inventory file,
displays all data for each item, and reports on the inventory
value. The cost value of each item and the
cost value of the total inventory should be
reported. Strive to duplicate the Sample Output
below.
Sample Output
Chica Chic Inventory
tops, $24.99 each, 10 in stock, value $249.90
shorts, $29.95 each, 12 in stock, value $359.40
sandals, $19.79 each, 8 in stock, value $158.32
End of file
Total inventory value $767.62
In: Computer Science
Online Store Simulator cpp files needed hpp files provided
You will be writing a (rather primitive) online store simulator. It will have three classes: Product, Customer and Store. To make things a little simpler for you, I am supplying you with the three .hpp files. You will write the three implementation files. You should not alter the provided .hpp files.
Here are the .hpp files: Product.hpp, Customer.hpp and Store.hpp three files are below the questions;
Here are descriptions of methods for the three classes:
Product:
A Product object represents a product with an ID code, title, description, price and quantity available.
constructor - takes as parameters five values with which to initialize the Product's idCode, title, description, price, and quantity available
get methods - return the value of the corresponding data member
decreaseQuantity - decreases the quantity available by one
Customer:
A Customer object represents a customer with a name and account ID. Customers must be members of the Store to make a purchase. Premium members get free shipping.
constructor - takes as parameters three values with which to initialize the Customer's name, account ID, and whether the customer is a premium member
get methods - return the value of the corresponding data member
isPremiumMember - returns whether the customer is a premium member
addProductToCart - adds the product ID code to the Customer's cart
emptyCart - empties the Customer's cart
Store:
A Store object represents a store, which has some number of products in its inventory and some number of customers as members.
addProduct - adds a product to the inventory
addMember - adds a customer to the members
getProductFromID - returns product with matching ID. Returns NULL if no matching ID is found.
getMemberFromID - returns customer with matching ID. Returns NULL if no matching ID is found.
productSearch - for every product whose title or description contains the search string, prints out that product's title, ID code, price and description
addProductToMemberCart - If the product isn't found in the inventory, print "Product #[idCode goes here] not found." If the member isn't found in the members, print "Member #[accountID goes here] not found." If both are found and the product is still available, calls the member's addProductToCart method. Otherwise it prints "Sorry, product #[idCode goes here] is currently out of stock." The same product can be added multiple times if the customer wants more than one of something.
checkOut - If the member isn't found in the members, print 'Member #[accountID goes here] not found.' Otherwise prints out the title and price for each product in the cart and decreases the available quantity of that product by 1. If any product has already sold out, then on that line it should print 'Sorry, product #[idCode goes here], "[product name goes here]", is no longer available.' At the bottom it should print out the subtotal for the cart, the shipping cost ($0 for premium members, 7% of the cart cost for normal members), and the final total cost for the cart (subtotal plus shipping). If the cart is empty, it should just print "There are no items in the cart." When the calculations are complete, the member's cart should be emptied.
Here is an example of how the output of the Store::productSearch method might look (searching for "red"):
red blender
ID code: 123
price: $350
sturdy blender perfect for making smoothies and sauces
hot air balloon
ID code: 345
price: $700
fly into the sky in your own balloon - comes in red, blue or
chartreuse
Here is an example of how the output of the Store::checkOutMember
method might look:
giant robot - $7000
Sorry, product #345, "live goat", is no longer available.
oak and glass coffee table - $250
Subtotal: $7250
Shipping Cost: $0
Total: $7250
In the main method you use for testing, you should only need to #include Store.hpp. Remember that your compile command needs to list all of the .cpp files.
customer.hpp
#ifndef CUSTOMER_HPP
#define CUSTOMER_HPP
#include
#include "Product.hpp"
class Customer
{
private:
std::vector cart;
std::string name;
std::string accountID;
bool premiumMember;
public:
Customer(std::string n, std::string a, bool pm);
std::string getAccountID();
std::vector getCart();
void addProductToCart(std::string);
bool isPremiumMember();
void emptyCart();
};
#endif
product.hpp
#ifndef PRODUCT_HPP
#define PRODUCT_HPP
#include
class Product
{
private:
std::string idCode;
std::string title;
std::string description;
double price;
int quantityAvailable;
public:
Product(std::string id, std::string t, std::string d, double p, int
qa);
std::string getIdCode();
std::string getTitle();
std::string getDescription();
double getPrice();
int getQuantityAvailable();
void decreaseQuantity();
};
#endif
store.hpp
#ifndef STORE_HPP
#define STORE_HPP
#include
#include "Customer.hpp"
class Store
{
private:
std::vector inventory;
std::vector members;
public:
void addProduct(Product* p);
void addMember(Customer* c);
Product* getProductFromID(std::string);
Customer* getMemberFromID(std::string);
void productSearch(std::string str);
void addProductToMemberCart(std::string pID, std::string
mID);
void checkOutMember(std::string mID);
};
#endif
In: Computer Science
In writing integers to a file you need to connect 2 streams together to accomplish this task. Below show the code you might use to connect 2 stream classes together. (Use a FileOutputStream and a DataOutputStream)
In: Computer Science
Write a program that calculates the student's final grade for a test with 20 multiple questions using C# .net Framework.
se an array of integers to store the test scores (0-incorrect answer, 1-correct answer). Initialize it as follows:
int [] scores = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1};
3. If the student answered the question right, add 5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total.
4. The running total is initialized with 5 points (so the student receives 5 points extra credit).
5. To define the final grade use the grading scale below
Score |
Grade |
90+ |
A |
80-89 |
B |
70-79 |
C |
60-69 |
D |
<60 |
F |
6. Write a helper method displayScoreGrade()that displays the score and calculated grade.
private static void displayGrade(double score, char grade){
//printing the score;
//printing the grade;
...
}
Call the method from the main method.
In: Computer Science
1. Create a1. Create a new java file named Name.java that should have Name class based on new java file named Name.java that should have Name class based on the following UML
Name
- first: String
- last: String
+ Name ()
+ Name (String firstName, String lastName)
+ getName () : String
+ setName (String firstName, String lastName) : void
+ getFirst () : String
+ setFirst (String firstName) : void
+ getLast () : String
+ setLast (String lastName) : void
+ printName () : void
Notes: Name() constructor should call the other constructor to set blank values for first and last variables; getName should call getFirst and getLast; setName should call setFirst and setLast; printName should call getName and then print the name in the following format (assuming that values of Rahul & Dewan were used to create the Name object) – Hello Rahul Dewan, Welcome to CIS1500 Course ! If the name is blank, it should display message like: Name is blank !
In: Computer Science