Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Question 1

a. Design a class called ISBN to represent an International Standard Book Number. The ISBN consists of 10 digits divided into 4 parts. For example, the ISBN 7 758871 47 5 represents the following information:  

 - The first part: The first digit "7" signifies the book is from a French-speaking country.  

- The second part: "758871" identifies the publisher.  

- The third part: "47" is the title number for the book.  

- The fourth part: "5" is a check digit to indicate that the sum of the ISBN digits is 10.  


The class should have a method to take input from the users and display it on the screen.  


b. Design a Book class that represents relevant information about a book, including the book's title, authorName, publisherName, Address (remember the class we created in Question-1 has a relationship) and price. Find out the relationship between Book and ISBN and code accordingly.  

 


Problem 3: A multi-graph is a graph which may have more than one edge (parallel edges) between a pair of vertices. Suppose that these graphs may also have self-loops (an edge from a vertex to itself). Given such a graph G as an input, print the adjacency list representation of an equivalent undirected graph G’, in which all the multiple edges between two vertices are replaced by a single edge, and all self-loops are removed. Your algorithm should run in O(n+m) time. Input Format: The input is a text file which gives the adjacency list representation of the multigraph. The first line specifies the number of vertices and edges n and m. The next m lines specify the m edges, one edge per line. Assume the vertices are numbered 0 to n-1.

Output Format: The adjacency list representation of the new graph G’.

Sample Input (for the graph above): 3 6

0 0

0 2

2 2

0 2

0 2

0 1

Sample Output: Adjacency list representation of G’: 0: 1 2 1: 0 2: 0


 Given an input undirected graph, create and print the adjacency list and adjacency matrix representations of the graph. Input Format: The input is a text file which describes an undirected graph. The first line of the file specifies n & m, the number of vertices and number of edges in the graph respectively. The next m lines specify the m edges of the graph, one line per edge. An edge is described by its end points. If the number of vertices is n, assume that the vertices of the graph are numbered (0,1,..n-1). Output Format: Print the adjacency list and adjacency matrix representation of the graph. In the adjacency list representation, for a given vertex, the order of its adjacent vertices does not matter.


Design a 'book' class with title, author,publisher, price and author's royalty as instance variables. Provide getter and setter properties for all variables. Also define a method royalty() to calculate royalty amount author can expect to receive the following royalties :10% of the retail price on the first 500 copies ;12.5% for the next, 1000 copies sold, then 15% for all further other copies sold


Half pyramid with numbers but the numbers printed from below like input 1and 3


Output will be


6


5 4


3 2 1

: A multi-graph is a graph which may have more than one edge (parallel edges) between a pair of vertices. Suppose that these graphs may also have self-loops (an edge from a vertex to itself). Given such a graph G as an input, print the adjacency list representation of an equivalent undirected graph G’, in which all the multiple edges between two vertices are replaced by a single edge, and all self-loops are removed. Your algorithm should run in O(n+m) time. Input Format: The input is a text file which gives the adjacency list representation of the multigraph. The first line specifies the number of vertices and edges n and m. The next m lines specify the m edges, one edge per line. Assume the vertices are numbered 0 to n-1. Output Format: The adjacency list representation of the new graph G’. Sample Input (for the graph above): 3 6 0 0 0 2 2 2 0 2 0 2 0 1 Sample Output: Adjacency list representation of G’: 0: 1 2 1: 0 2: 0


Given a directed graph in adjacency matrix form, determine if it contains a universal sink – a vertex with in-degree n-1 and out-degree 0. (The number of vertices in the graph is n.) Input Format: The input is a text file which gives the adjacency matrix representation of a directed graph. Sample Input (for the graph above): 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 Sample Output: Yes 


Problem 1: Given input undirected graph, create and print adjacency list and adjacency matrix representations graph. Input Format: The input is a text file which describes undirected graph. The first line file specifies n & m, number of vertices and number edges graph respectively. The next m lines specify m edges of the graph, one line per edge. An edge described by its end points. If number vertices is n, assume that vertices graph are numbered (0,1,..n-1). Output Format: Print adjacency list and adjacency matrix representation of the graph. adjacency list representation, for given vertex, order of its adjacent vertices does not matter. Sample Input (for the graph shown above): 8 10 0 1 1 2 0 3 3 4 3 6 4 6 5 4 5 6 7 6 5 7 Sample Output: Adjacency list representation: 0: 1 3 1: 0 2 2: 1 3: 0 6 4 4: 3 6 5 5: 4 6 7 6: 3 5 4 7 7: 5 6 Adjacency matrix representation: 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 0


preprocess the data and by giving a proper rationale behind the steps you would follow. The two datasets should be merged before preprocessing. first task in your new job, to check the quality of the data for the next step of analysis. Following are the additional description

a)    The data set contains six variables - Date,Open,Close,HIgh,Low,volume

                                      

the stock market opens at 9:15 hours and closes at 15:30 hours. Each stock is defined by an opening and a closing price which are the prices it opens and closes with. Within the operating hours, the stock price touches a maximum and minimum which are the highest and lowest prices achieved by the stock in the working hours of the stock market. You have access to ten years of monthly stock price data . On some days when there is no trading.Furthermore, your manager also claims that the model prediction is too bad since data is polluted. 



Write a code to convert a one dimensional array into three dimensional array using built-in function.