In: Computer Science
HW_7d - Cat class
Create 3 files:
the weight is assigned to Fluffy’s weight.
the color is assigned to Fluffy’s color
of each cat.
meow method.
/* OUTPUT:
So you have three cats...
Describe Fluffy. What does she weight? 4
What color is she? brown
Describe Tom. What does he weight? 9
What color is he? orange
Describe Kitty. What does she weight? 5
What color is she? white
Fluffy weights 4 pounds and is brown.
Tom weighs 9 pounds and is orange.
Kitty weighs 5 pounds and is white.
Fluffy says: MEOW!
Tom says: MEOW!
Kitty says: MEOW!
Press any key to continue */
Code Language: C++
Please add comments for each code.
In: Computer Science
(Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping options, each with specific costs associated. Create an inheritance hierarchy to represent various types of packages. Use class Package as the base class of the hierarchy, then include classes TwoDayPackage and OvernightPackage that derive from Package.
Base-class Package should include data members representing the name, address, city, state and ZIP code for both the sender and the recipient of the package, in addition to data members that store the weight (in ounces) and cost per ounce to ship the package. Package’s constructor should initialize these data members. Ensure that the weight and cost per ounce contain positive values. Package should provide a public member function calculateCost that returns a double indicating the cost associated with shipping the package. Package’s calculateCost function should determine the cost by multiplying the weight by the cost per ounce.
Derived-class TwoDayPackage should inherit the functionality of base class Package, but also include a data member that represents a flat fee that the shipping company charges for two-day-delivery service. TwoDayPackage’s constructor should receive a value to initialize this data member. TwoDayPackage should redefine member function calculateCost so that it computes the shipping cost by adding the flat fee to the weight-based cost calculated by base class Package’s calculateCost function.
Class OvernightPackage should inherit directly from class Package and contain an additional data member representing an additional fee per ounce charged for overnight-delivery service. OvernightPackage should redefine member function calculateCost so that it adds the additional fee per ounce to the standard cost per ounce before calculating the shipping cost. Write a test program that creates objects of each type of Package and tests member function calculateCost.
please send a link to a repl.it file to help find the solution or separate the files with names so I can know different header files to use
use c++
In: Computer Science
This is a question for a Computer Organization course:
Answer the following with 1 to 2 short SENTENCES for full credit:
In: Computer Science
Using C++, develop a project that uses the various concepts you have learned over the course the term. The purpose of this project is to understand important data structures and learn how to implement them so that improve programming skills as well. Your final deliverable can be a program to do some type of useful computation. It can be a retail management system that keeps track of the daily delivery orders by customers; or a clinic reservation system that bookkeeps patient information and manages bookings. These are ideas to help you find a project, not to restrict you; in other words, if you want to do something substantial and interesting (and has the required features described below), but it does not strictly fall into one of these categories, you may still do that.
My subject is data structure
Your project must have each of the following features:
1) It must use an efficient algorithm for sorting or searching or both, for some aspect of the project.
2) It must involve a linked-list implementation (e.g., stack, queue, etc.).
3) It must involve an implement of the binary tree ADT using a linked-list
Help me!!!!
In: Computer Science
Java Programming:
Using textI/O models, create a Write file, Append file, and a Read file. Write 10 fahrenheit temperature to a text file, append 5 more temperatures, then read these numbers calculating, in a method, the Celsius temperature, and printing the results via another method.
In: Computer Science
For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word from the list to be the target of the game. The user is then allowed to guess characters one at a time. The program checks to see if the user has previously guessed that character and if it has been previously guessed the program forces the user to guess another character. Otherwise it checks the word to see if that character is part of the target word. If it is, it reveals all of the positions with that target word. The program then asks the user to guess the target, keeping count of the number of guesses. When the user finally guesses the correct word, the program indicates how many guesses it took the user to get it right.
For this assignment you must start with the following "skeleton" of Java code. Import this into your Eclipse workspace and fill in the methods as directed. In addition, for this assignment you MUST add at least one extra method beyond the methods defined in the skeleton. This must be a method that does something useful - if you are stuck for an idea for a method, get the program working first and then see if there is some part of your main method that you can break out to be its own function or procedure instead.
Feel free to add any additional methods you find useful, but for all of the methods you add you must also add comments indicating what they do following the form of the rest of the comments in the code.
NOTE: If the file that the user enters for the word list does not exist or if it is an empty file with no words in it, your program should print the Goodbye! message and exit gracefully without crashing.
/**
* Your description here
* @author ENTER YOUR NAME HERE
* @version ENTER DATE HERE
*
*/
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class WordGuessing {
/**
* Takes a filename as input. Reads a list of words from the file into a
* list and returns the list. Ensures that all of the words in the list are
* in UPPERCASE (i.e. transforms lowercase letters to uppercase before
* adding them to the list). Assumes that the file will be correctly
* formatted with one word per line (though there may be blank lines with
* no words on them). If the file cannot be read prints the
* error message "ERROR: File fname not found!" where "fname" is the name of
* the file and returns an empty list. Note that the order of the words in the
* list must be the same as the order of the words in the file to pass the
* test cases.
*
* @param fname
* the name of the file to read words from
* @return a list of words read from the file in all uppercase letters.
*/
public static List<String> readWords(String fname) {
List<String> words = new ArrayList<String>();
// TODO - complete this function
// TODO - the following line is only here to allow this program to
// compile. Replace it and remove this comment when you complete
// this method.
return words;
}
/**
* Takes a Random object and a list of strings and returns a random String
* from the list. Note that this method must not change the list. The list
* is guaranteed to have one or more elements in it.
*
* @param rnd
* Random number generator object
* @param inList
* list of strings to choose from
* @return an element from a random position in the list
*/
public static String getRandomWord(Random rnd, List<String> inList) {
// TODO - complete this function
// TODO - the following line is only here to allow this program to
// compile. Replace it and remove this comment when you complete
// this method.
return null;
}
/**
* Given a String, returns a StringBuilder object that is the same length
* but is only '*' characters. For example, given the String DOG as input
* returns a StringBuilder object containing "***".
*
* @param inWord
* The String to be starred
* @return a StringBuilder with the same length as inWord, but all stars
*/
public static StringBuilder starWord(String inWord) {
// TODO - complete this function
// TODO - the following line is only here to allow this program to
// compile. Replace it and remove this comment when you complete
// this method.
return null;
}
/**
* Prompts the user to enter a single character. If the user enters a blank
* line or more than one character, give an error message as given in the
* assignment and prompt them again. When the user enters a single
* character, return the uppercase value of the character they typed.
*
* @param inScanner
* A scanner to take user input from
* @return the uppercase value of the character typed by the user.
*/
public static char getCharacterGuess(Scanner inScanner) {
// TODO - complete this function
// TODO - the following line is only here to allow this program to
// compile. Replace it and remove this comment when you complete
// this method.
return 0;
}
/**
* Count the number of times the character ch appears in the String word.
*
* @param ch
* character to count.
* @param word
* String to examine for the character ch.
* @return a count of the number of times the character ch appears in the
* String word
*/
public static int charCount(char ch, String word) {
// TODO - complete this function
// TODO - the following line is only here to allow this program to
// compile. Replace it and remove this comment when you complete
// this method.
return 0;
}
/**
* Modify the StringBuilder object starWord everywhere the char ch appears
* in the String word. For example, if ch is 'G', word is "GEOLOGY", and
* starWord is "**O*O*Y", then this method modifies starWord to be
* "G*O*OGY". Your code should assume that word and starWord are
* the same length.
*
* @param ch
* the character to look for in word.
* @param word
* the String containing the full word.
* @param starWord
* the StringBuilder containing the full word masked by stars.
*/
public static void modifyStarWord(char ch, String word,
StringBuilder starWord) {
// TODO - complete this function
}
public static void main(String[] args) {
// TODO - complete this function
}
}
You can use the following word list for your program, but the list below is the one that the test cases will use. Create a new text file in your project directory and paste the following words into it. Note that your program must be able to deal correctly with blank lines (i.e. ignore them when it reads the file and do not add empty strings to the word list).
MIGHTY crimes FLIGHT FRIGHT Grimes PLACES TRACES plates Fisher fishes WISHES dishes
When your program runs, you must be able to produce the following transcript. Note the behavior that the transcript produces when the player tries to guess a character they have previously guessed, when they enter blank lines for the character or the word guess, and when they enter anything but a 'Y' or 'N' (upper or lowercase) for the rematch question.
Enter a random seed: 33 Enter a filename for your wordlist: words.txt Read 12 words from the file. The word to guess is: ****** Previous characters guessed: [] Enter a character to guess: f The character F occurs in 1 positions. The word to guess is: F***** Enter your guess for the word: flames That is not the word. The word to guess is: F***** Previous characters guessed: [F] Enter a character to guess: i The character I occurs in 1 positions. The word to guess is: F*I*** Enter your guess for the word: flight That is not the word. The word to guess is: F*I*** Previous characters guessed: [F, I] Enter a character to guess: tjkl Enter only a single character! Enter a character to guess: Enter only a single character! Enter a character to guess: t The character T occurs in 1 positions. The word to guess is: F*I**T Enter your guess for the word: That is not the word. The word to guess is: F*I**T Previous characters guessed: [F, I, T] Enter a character to guess: o The character O occurs in 0 positions. The word to guess is: F*I**T Enter your guess for the word: flitter That is not the word. The word to guess is: F*I**T Previous characters guessed: [F, I, T, O] Enter a character to guess: G The character G occurs in 1 positions. The word to guess is: F*IG*T Enter your guess for the word: fight That is not the word. The word to guess is: F*IG*T Previous characters guessed: [F, I, T, O, G] Enter a character to guess: h The character H occurs in 1 positions. The word to guess is: F*IGHT Enter your guess for the word: Fright Yes! FRIGHT is the correct word! That took you 6 guesses. Would you like a rematch [Y/N]?: jsdf Please enter only a Y or an N. Would you like a rematch [Y/N]?: Please enter only a Y or an N. Would you like a rematch [Y/N]?: yes Please enter only a Y or an N. Would you like a rematch [Y/N]?: no Please enter only a Y or an N. Would you like a rematch [Y/N]?: n Goodbye!
Another run of the same program should be able to produce the following transcript:
Enter a random seed: 2048 Enter a filename for your wordlist: words.txt Read 12 words from the file. The word to guess is: ****** Previous characters guessed: [] Enter a character to guess: s The character S occurs in 1 positions. The word to guess is: *****S Enter your guess for the word: slimes That is not the word. The word to guess is: *****S Previous characters guessed: [S] Enter a character to guess: r The character R occurs in 1 positions. The word to guess is: *R***S Enter your guess for the word: grimes That is not the word. The word to guess is: *R***S Previous characters guessed: [S, R] Enter a character to guess: c The character C occurs in 1 positions. The word to guess is: CR***S Enter your guess for the word: crimes Yes! CRIMES is the correct word! That took you 3 guesses. Would you like a rematch [Y/N]?: y The word to guess is: ****** Previous characters guessed: [] Enter a character to guess: s The character S occurs in 2 positions. The word to guess is: **S**S Enter your guess for the word: dishes That is not the word. The word to guess is: **S**S Previous characters guessed: [S] Enter a character to guess: f The character F occurs in 1 positions. The word to guess is: F*S**S Enter your guess for the word: fishes Yes! FISHES is the correct word! That took you 2 guesses. Would you like a rematch [Y/N]?: y The word to guess is: ****** Previous characters guessed: [] Enter a character to guess: s The character S occurs in 1 positions. The word to guess is: *****S Enter your guess for the word: slimes That is not the word. The word to guess is: *****S Previous characters guessed: [S] Enter a character to guess: r The character R occurs in 1 positions. The word to guess is: *R***S Enter your guess for the word: drimes That is not the word. The word to guess is: *R***S Previous characters guessed: [S, R] Enter a character to guess: g The character G occurs in 1 positions. The word to guess is: GR***S Enter your guess for the word: grimes Yes! GRIMES is the correct word! That took you 3 guesses. Would you like a rematch [Y/N]?: n Goodbye!
In: Computer Science
Given the following schema, write the Relational Algebra and SQL statements for the given conditions:Depositor (customer_name, account_number) Borrower (customer_name, loan_number) Loan ( branch_name, loan_number, amount) Account (branch_name, account_number, balance) Branch(branch_name, branch_city, assets) Customer (customer_name, customer_street, customer_city) 1. Find all the customers who have a loan and an account 2. Find the minimum account balance at the Downtown branch. 3. Find the number of tuples in the customer relation. 4. Find the names of all the account numbers and the branch names whose balance is over BD1000. 5. Find the sum of the loans whose branch name is Mianus. 6. Find the number of customers who have a loan. 7. Find the maximum amount of loan taken by a customer. 8. Find the names of the branches and their branch cities whose assets are greater than 50000 and less than 80000.
In: Computer Science
You are given the partial implementation of class IntegerLinkedList which stores integers in the inked list. Add a public member function that does the following:
// Complete this for Problem 2
int getSmallestIndex(): return the smallest of integers stored in the linked list.
A main file (prob2.cpp) is provided:
#include <iostream>
#include <string>
#include "IntegerLinkedList.h"
using std::string;
using std::cout;
using std::endl;
int main() {
{
IntegerLinkedList mylist;
mylist.addFront(10);
mylist.addFront(17);
mylist.addFront(23);
mylist.addFront(17);
mylist.addFront(92);
if (mylist.getIndexSmallest() == 4)
cout << "PASSED" << endl;
else
cout << "Result did not match expected answer: 4" << endl;
}
{
IntegerLinkedList mylist;
mylist.addFront(10);
mylist.addFront(17);
mylist.addFront(23);
mylist.addFront(37);
mylist.addFront(2);
if (mylist.getIndexSmallest() == 0)
cout << "PASSED" << endl;
else
cout << "Result did not match expected answer: 0" << endl;
}
// system("pause"); // comment/uncomment if needed
}
// ADD ANSWER TO THIS FILE
#pragma once
class SNode {
public:
int data;
SNode *next;
};
class IntegerLinkedList {
private:
SNode *head;
bool isLesser (SNode *ptr, int compare) {
return false; // COMPLETE THIS FOR PROBLEM 3
}
public:
IntegerLinkedList() {
head = nullptr;
}
void addFront(int x) {
SNode *tmp = head;
head = new SNode;
head->next = tmp;
head->data = x;
}
int getIndexSmallest(); // COMPLETE THIS FOR PROBLEM 2
// recursion helper function called from main
bool isLesserHelper (int compare) {
return isLesser(head, compare);
}
};
Add a recursive function called isLesser to class IntegerLinkedList to calculate the smallest of the linked list’s data values (same as in Problem 2 but recursive).
A recursion “helper” function is already included in class IntegerLinkedList. You only need to write the recursive function.
//PROBLEM 3
#include <iostream>
#include <string>
#include "IntegerLinkedList.h"
using std::string;
using std::cout;
using std::endl;
int main() {
{
IntegerLinkedList mylist;
mylist.addFront(10);
mylist.addFront(17);
mylist.addFront(23);
mylist.addFront(17);
mylist.addFront(92);
if (mylist.isLesserHelper(15))
cout << "PASSED" << endl;
else
cout << "Result did not match expected answer: true" << endl;
if (!mylist.isLesserHelper(5))
cout << "PASSED" << endl;
else
cout << "Result did not match expected answer: false" << endl;
if (mylist.isLesserHelper(100))
cout << "PASSED" << endl;
else
cout << "Result did not match expected answer: true" << endl;
}
// system("pause"); // comment/uncomment if needed
}
// ADD ANSWER TO THIS FILE
#pragma once
class SNode {
public:
int data;
SNode *next;
};
class IntegerLinkedList {
private:
SNode *head;
bool isLesser (SNode *ptr, int compare) {
return false; // COMPLETE THIS FOR PROBLEM 3
}
public:
IntegerLinkedList() {
head = nullptr;
}
void addFront(int x) {
SNode *tmp = head;
head = new SNode;
head->next = tmp;
head->data = x;
}
int getIndexSmallest(); // COMPLETE THIS FOR PROBLEM 2
// recursion helper function called from main
bool isLesserHelper (int compare) {
return isLesser(head, compare);
}
};In: Computer Science
1. Why is leadership outlook on security critical to employee buy-in at all levels? Give examples to justify your position.
2. How can the CIA triad of security be applied to an organization and not just a single system? Give examples to support your position.
3. What are some of the legal issues involved with privacy data? List at least three of these issues and the type of system that would need to consider legal use of the data associated with the issue.
4. What are the challenges to implementing security policies in an organization when they have not been in place previously? Give examples to support your position.
In: Computer Science
The output of the function is a dictionary whose keys represent the bins and whose values are ints indicating the number of data items in each bin. How you represent the keys is up to you - there are several acceptable approaches, but care should be taken to use a structure that is compatible
In: Computer Science
in your own opinion, It has been said that a smartphone is a computer in your hand. Discuss the security implications of this statement.
In: Computer Science
Use the internet to read more about journaling file systems such as NTFS, extfs2, and extfs3. Discuss the most significant points, including the primary advantages and disadvantages of journaling file systems.
In: Computer Science
Consider the quick sort algorithm.
The quick sort algorithm is a divide and conquer approach which chooses a pivot value and divides the subarrays as the lower values on the left and the bigger values on the right (comparing them to pivot). Then, each subarray is processed similarly until the array becomes sorted.
Quick sort algorithm has an average time complexity of O(nlogn). However, if the array to be used in the quicksort is already sorted, then the complexity becomes O(n2).
In this question, modify the quicksort algorithm. Therefore, you will use a randomized partitioning algorithm that shuffles the array first and then chooses a pivot value. (in your cpp file)
Also analyze, what will change by following such an approach. What will be the complexity? Write down your analysis (in a docx file).
In: Computer Science
Assignment # 12: Email Presentation
Learning Objectives and Outcomes
Assignment Requirements
You are an employee of the DigiFirm Investigation Company. As part of its community outreach effort, the company is preparing a series of short presentations for local middle school students on computer-related topics. You have been asked to contribute a presentation that focuses on email.
For this assignment, create a PowerPoint presentation that includes:
In: Computer Science