Shindler gives lots of homework assignments, each of which have an easy version and a hard version1. Each student is allowed, for each homework, to submit either their answer to the easy version (and get ei > 0 points) or the hard version (and get hi > 0 points, which is also guaranteed to always be more than ei) or to submit neither (and get 0 points for the assignment). Note that ei might have different values for each i, as might hi. The values for all n assignments are known at the start of the semester.
The catch is that the hard version is, perhaps not surprisingly, more difficult than the easy version. In order for you to do the hard version, you must have not done the previous assign- ment at all: neither the easy nor the hard version (and thus are more relaxed, de-stressed, etc). Your goal is to maximize the number of points you get from homework assignments over the course of the semester. Give an efficient dynamic programming algorithm to determine the largest number of points possible for a given semester’s homework choices.
In: Computer Science
Doradla, P., Joseph, C., & Giles, R. H. (2017). Terahertz endoscopic imaging for colorectal cancer detection: Current status and future perspectives. World journal of gastrointestinal endoscopy, 9(8), 346.
Lambin, P., Leijenaar, R. T., Deist, T. M., Peerlings, J., De Jong, E. E., Van Timmeren, J., ... & van Wijk, Y. (2017). Radiomics: the bridge between medical imaging and personalized medicine. Nature reviews Clinical oncology, 14(12), 749-762.
Stouthandel, M. E., Veldeman, L., & Van Hoof, T. (2019). Call for a multidisciplinary effort to map the lymphatic system with advanced medical imaging techniques: a review of the literature and suggestions for future anatomical research. The Anatomical Record, 302(10), 1681-1695.
Bödenler, M., de Rochefort, L., Ross, P. J., Chanet, N., Guillot, G., Davies, G. R., ... & Broche, L. M. (2019). Comparison of fast field-cycling magnetic resonance imaging methods and future perspectives. Molecular physics, 117(7-8), 832-848.
Zhou, L. Q., Wang, J. Y., Yu, S. Y., Wu, G. G., Wei, Q., Deng, Y. B., ... & Dietrich, C. F. (2019). Artificial intelligence in medical imaging of the liver. World journal of gastroenterology, 25(6), 672.
In: Computer Science
In Python 3:
Software Design Patterns may be thought of as blue prints or recipes for implementing common models in software. Much like re-using proven classes in Object Oriented design, re-using proven patterns tends to produce more secure and reliable results often in reduced time compared to re-inventing the wheel. In fact, some high-level languages have integrated facilities to support many common patterns with only minimal, if any, user written software. That said, in software design and construction, often the challenge is to know that a pattern exists and be able to recognize when it is a good fit for a project. To give you a familiar frame of reference, below is a Singleton Pattern implemented in Java:
public class MySingleton {
// reference to class instance
private static MySingleton instance = null;
// Private Constructor
private MySingleton() {
instance = this;
}
// Returns single instance to class
public static MySingleton getInstance() {
if (instance == null) {
instance = new MySingleton();
}
return instance;
}
public static void main(String[] args)
{
MySingleton s1 = MySingleton.getInstance();
MySingleton s2 = MySingleton.getInstance();
System.out.println("s1: " + s1 + " s2: " + s2);
}
}
If you run this example, you will see that the address for s1 and s2 are exactly the same. That is because the pattern restricts the existence of more than one instance in a process. Of course this example only implements the pattern but other functionality can be added to this class just as any other class. The primary features of a singleton are:
The primary goal of this assignment is not to teach you how to write singleton patterns in Python, (though that’s part of it), but to familiarize you with the concept of design patterns as well as give you experience in adapting one into one of your own designs.
Description
Pick one of your previous assignments, either from MindTap or one of your Distributed Systems assignments and integrate a Singleton Pattern into it. Hint: Any class can be made into a Singleton.
Code to integrate Singleton pattern into:
import random
class Card(object):
""" A card object with a suit and rank."""
RANKS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
SUITS = ('Spades', 'Diamonds', 'Hearts', 'Clubs')
def __init__(self, rank, suit):
"""Creates a card with the given rank and suit."""
self.rank = rank
self.suit = suit
self.faceup = False
def turn(self):
self.faceup = not self.faceup
def __str__(self):
"""Returns the string representation of a card."""
if self.rank == 1:
rank = 'Ace'
elif self.rank == 11:
rank = 'Jack'
elif self.rank == 12:
rank = 'Queen'
elif self.rank == 13:
rank = 'King'
else:
rank = self.rank
return str(rank) + ' of ' + self.suit
class Deck(object):
""" A deck containing 52 cards."""
def __init__(self):
"""Creates a full deck of cards."""
self.cards = []
for suit in Card.SUITS:
for rank in Card.RANKS:
c = Card(rank, suit)
self.cards.append(c)
def shuffle(self):
"""Shuffles the cards."""
random.shuffle(self.cards)
def deal(self):
"""Removes and returns the top card or None
if the deck is empty."""
if len(self) == 0:
return None
else:
return self.cards.pop(0)
def __len__(self):
"""Returns the number of cards left in the deck."""
return len(self.cards)
def __str__(self):
"""Returns the string representation of a deck."""
result = ''
for c in self.cards:
result = self.result + str(c) + '\n'
return result
def main():
"""A simple test."""
deck = Deck()
print("A new deck:")
while len(deck) > 0:
print(deck.deal())
deck = Deck()
deck.shuffle()
print("A deck shuffled once:")
while len(deck) > 0:
print(deck.deal())
if __name__ == "__main__":
main()
In: Computer Science
In: Computer Science
Draw an ERD diagram for Hair Saloon and describe its relationship
In: Computer Science
Q, Haskell.
I need to define function encode and decode. Details about the functions are provided in code.
-- | encode -- -- Given a string, return a list of encoded values of type (Int,Char) -- -- >>> encode ['a','a','a','a','b','c','c','a','a','d','e','e','e','e'] -- [(4,'a'),(1,'b'),(2,'c'),(2,'a'),(1,'d'),(4,'e')] -- -- >>> encode "hello" -- [(1,'h'),(1,'e'),(2,'l'),(1,'o')] -- -- >>> encode [] -- [] -- encode :: String -> [(Int,Char)] encode = undefined -- | decode -- -- Given a list of encoded values of type (Int,Char), generate a string corresponding to -- this encoding. -- -- If the first element of any pair in the list is equal to zero or negative, -- skip the corresponding character in the output string, -- while still providing decodings for the remaining characters. -- -- -- >>> decode [(4,'a'),(1,'b'),(2,'c'),(2,'a'),(1,'d'),(4,'e')] -- "aaaabccaadeeee" -- -- >>> decode [] -- "" -- -- >>> decode [(-4,'a')] -- "" -- -- >>> decode [(3,'c'),(-4,'a'),(5,'b')] -- "cccbbbbb" -- -- >>>decode [(3,'c'),(0,'a'),(5,'b')] -- "cccbbbbb" -- -- prop> \x -> x == decode (encode x) -- decode :: [(Int,Char)] -> String decode = undefined
In: Computer Science
You need to create a Java class library to support a program to simulate a Point- of-Sale (POS) system.
General Requirements:
You should create your programs with good programming style and form using proper blank spaces, indentation and braces to make your code easy to read and understand;
You should create identifiers with sensible names;
You should make comments to describe your code segments where they are necessary for
readers to understand what your code intends to achieve.
Logical structures and statements are properly used for specific purposes.
Program Requirements
You create three classes: ProductPrices, ShoppingCart and CashRegister in the filePOSLib.java to support a POS system implemented in the program POSmain.java, which is provided.
The POSmain program takes three file names from command line arguments. The first file contains a list of products and their prices; the second and third files are lists of items in two shopping carts of two customers. The POSmain program should first read the price file, then read each of the cart files to load a list of items in a shopping cart and store them in a ShoppingCartobjects. The price file may contain a variable number of products and the cart files may contain a variable number of items.
POSmain then will create a CashRegister object by passing the price list to it. The POSmainprogram then will use the CashRegister object to scan items in a cart and print a receipt for each shopping cart one by one. At last, POSmain will use the CashRegister object to print a report for the day.
The three classes you will create are described in the following UML design class diagrams. You must implement all specified fields and methods in the classes. You are free to add private fields and methods to CashRegister class if appropriate.
ProductPrices |
-products: ArrayList<String> -prices: ArrayList<Double> +put(String product, double price) +get(String product): double |
The put method will store the price for the product in the products and prices fields, respectively;
The get method will return the price for the product.
ShoppingCart |
-items: ArrayList<String> |
+addItem(String): void +getAllItems(): ArrayList<String> |
The addItem method will add the product to the shopping cart;
The getAllItems method will return all items in the shopping cart.
CashRegister |
-productPrices: ProductPrices ...... |
+CashRegister(ProductPrices) +scanAllItemsInCart(ShoppingCart): void +printReceipt(): void +printReportForTheDay(): void ...... |
The constructor will initialise the CashRegister object with the product prices;
The scanAllItemsInCart will examine all items in the shopping cart and prepare to
print the receipt for the shopping cart and report for the day;
The printReceipt method will print the product name, price, quantity, subtotal, and
total purchase for a shopping cart in the alphabetical order of the product names. Refer to the Testing section for the receipt format;
• The printReportForTheDay method will print a report for the day in the alphabetical order of the product names for the cash register. Refer to the Testing section for the report format.
You need to understand the POSmain program and observe the sample output in the Testing section to understand more how the program will work with the classes.
In: Computer Science
The academic, inventory, and financial information at the CSE (Computer Science and Engineering) department of a certain institute was being carried out manually by two office clerks, a store keeper, and two attendants. The department has a student strength of 500 and a teacher strength of 30. The head of the department (HoD) wants to automate the office work. Considering the low budget that he has at his disposal, he entrusted the work to a team of student volunteers. For requirements gathering, a member of the team who was responsible for requirements analysis and specification (analyst) was first briefed by the HoD about the specific activities to be automated. The HoD mentioned that three main aspects of the office work needs to be automated—stores-related activities, student grading activities, and student leave management activities. It was necessary for the analyst to meet the other categories of users. The HoD introduced the analyst (a student) to the office staff. The analyst first discussed with the two clerks regarding their specific responsibilities (tasks) that were required to be automated. For each task, they asked the clerks to brief them about the steps through which these are carried out. The analyst also enquired about the various scenarios that might arise for each task. The analyst collected all types of forms that were being used by the student and the staff of the department to register various types of information with the office (e.g. student course registration, course grading) or requests for some specific service (e.g. issue of items from store). He also collected samples of various types of documents (outputs) the clerks were preparing. Some of these had specific printed forms that the clerks filled up manually, and others were entered using a spreadsheet, and then printed out on a laser printer. Fo r each output form, the analyst consulted the clerks regarding how these different entries are generated from the input data. The analyst met the store keeper and enquired about the material issue procedures, store ledger entry procedures, and the procedures for raising indents on various vendors. He also collected copies of all the relevant forms that were being used by the store keeper. The analyst also interviewed the student and faculty representatives. Since it was needed to automate the existing activities of an working office, the analyst could without much difficulty obtain the exact formats of the input data, output data, and the precise description of the existing office procedures.
1. Draw use case and class diagram.
2. Write 5 functional and non-functional requirements.
In: Computer Science
When multimedia developers produce Bitmapped Images, they must consider that a bitmapped image is device-dependent. For that reason, they often need to produce multiple bitmapped images that have different spatial resolutions based on their intended use. For example, they produce a bitmapped image to be printed, and reduce its spatial resolution to be displayed on monitors.
What does it mean to say that a bitmapped image is device-dependent? Explain why different resolutions of bitmapped images are needed for different devices such as monitors and printers.
Please write, not a screenshot
In: Computer Science
6.explain characterizing schedules based on recoverability and serialibality.(50marks)
Need own answer and no internet answers r else i il downvote nd report to chegg.Even a single is wrong i il downvote.its 50marks question so no short answer minimum 10page answer required and own answer r else i il downvote.
Note:Minimum 10page answer and no plagarism r else i il downvote and report to chegg.Minimum 10 to 15page answer required r else dnt attempt.strictly no internet answer n no plagarism.
its 50marks question so i il stricly review nd report
Note:Its already there in chegg and its wrong answer i need own answer and correct answer r else i il downvote
In: Computer Science
Imagine a situation that you are on an island in the middle of a sea . The island is of around 10km long and put one transmitting antenna at one end of the island and another receiving antenna at the other island. The island has no man-made infrastructure but has trees, plants and animals. List the types of attenuation that the transmission signals will suffer and explain why?
In: Computer Science
Q1: The expression A = (E – F)/((P + (3*Q))*((2*R) – (5*S))) is not a valid SPLan assignment statement. Write a sequence of assignment statements that will perform the equivalent calculation.
Q2: Write a program which asks the user to input an integer. If the integer is less than zero, the program should output the message “Negative, the absolute value is ”, followed by the absolute value of the number. If the input is zero, the program should output the message “Zero.” If the input is greater than zero, the program should output the message “Positive.”
In: Computer Science
Using*************** C++ **************** explain what Objects and Classes are. Please describe in detail.
In: Computer Science
Problem 8.1: Consider each of the tasks below:
Match each of the following functions from the ggplot2 graphics package with the task it performs.
(in R code)
In: Computer Science
Using python, write a function calcA() that determines the area under the curve ?(?) = ?? −? over the range ?1 to ?2. The area is to be determined approximately as follows: ? = ∫ ?(?) ?? ?2 ?1 ≈ ∑ 1 2 (?(?? ) + ?(??−1 ))∆? ? ?=1 (1) Where ? is the number of intervals over the range ?1 to ?2. So if ? is equal to 10, then ∆? = (?2 − ?1)/10. This function receives the two range limits and divides it into ? intervals and generates ? + 1 values and puts them in a list. The function will then iterate over this list and implement (1), above, to calculate the area under the curve. Test your calcA() function over the range 0 to 5 w. Then calculate the area of a rectangle, which is equal to 5.
In: Computer Science