CS代考|JavaScript代考,80+ Marks高分Pass

Java 和 Javascript 的关系就像雷锋和雷峰塔的关系,一般认为,当时 Netscape 之所以将 LiveScript 命名为 JavaScript,是因为 Java 是当时最流行的编程语言,带有 “Java” 的名字有助于这门新生语言的传播。


它们的语法和 C 语言都很相似;
JavaScript 在设计时参照了 Java 的命名规则;

JavaScript 是动态类型语言,而 Java 是静态类型语言;
JavaScript 是弱类型的,Java 属于强类型;
JavaScript 的面向对象是基于原型的(prototype-based)实现的,Java 是基于类(class-based)的;
JavaScript 除了长得和 Java 比较像之外,语言风格相去甚远。JavaScript 在设计时所参考的对象不包括 Java,而包括了像 Self 和 Scheme 这样的语言。


  1. What are the policies of Java and C++ surrounding covariance, contravariance and nonvariance?
  2. Define inheritence by generalization. What is a better OO solution to a situation using this form of inheritance?
  3. Describe two situations when using separate compilation in C++ which require you to #include a header file.
  4. What is the role of the Class Object in ruby? Suppose you define a class called MyClass. What is the type of the Class Object in ruby for MyClass?
  5. What are the roles of packages in Java? Why would we put two classes in the same package (or different packages)? What is the significance of public classes in a package?
  6. Suppose you have been given the following three interfaces in Java:

interface Atom {
String to_string();
interface Iterator {
boolean hasNext();
Atom getNext();

interface Set extends Atom {
boolean add (Atom s);
//add s to Set, returns true if Set was modified.
boolean remove (Atom s);
//remove s from Set, returns true if Set was modified.
boolean contains (Atom s);
// returns whether s is in the Set
Iterator iterator();
// returns an iterator over the Set.

Suppose you are also given the following Factory class for producing sets, where
makeEmptySet() creates a new empty set:
class SetFactory {
public static Set makeEmptySet() {// code omitted }

a) Write a class called Vertex that implements the Atom interface. The Vertex class represents a single vertex of a directed graph (see (b) for more info on directed graphs if necessary). A Vertex contains a unique integer ID (supplied to the constructor) as well as a Set of Atoms, which represents all other vertices that the Vertex can reach by a directed edge. The string representation of a Vertex is simply its integer ID. Provide tools for clients of the Vertex class to modify the Set of adjacent vertices, using proper OO techniques.

b) Write a class to implement a directed graph class that satisfies the following interface: public interface Digraph {
Vertex addNewVertex(); boolean isVertex( Vertex v);
void addEdge(Vertex src, Vertex dest);
boolean areAdjacent( Vertex src, Vertex dest);
void printAdjacent (Vertex src);
void printVertices();

Recall that a directed graph consists of a collection of vertices and edges that are oriented: that is, they go from a vertex to another vertex. There is at most one edge going from one edge to another (but the reverse direction edge can also exist). Your implementation will be an adjacency list implementation.

The methods from the Digraph interface should work as follows:
a. addNewVertex adds a new Vertex to the graph, and the Vertex is returned. The ID of the created Vertex is arbitrary, but different from all other vertices in the graph.
b. isVertex should take a Vertex parameter and determine if it is a vertex in the digraph.
c. addEdge adds a new directed edge to the graph that travels from Vertex src to Vertex dest. If the edge already exists, or the vertices are not in the graph, the method does nothing.
d. areAdjacent answers whether there is a single edge (not a longer path) from src to dest. If the vertices do not exist in the graph, the method returns false.
e. printAdj prints all of the edges that can be reached from the vertex src by a single edge (not a longer path). If the vertices do not exist in the graph, the method prints nothing.
f. printVertices should print all the vertices of the graph.


Assignment Exmaple

Recent Case

Service Scope

oop|Processing|JS|Ruby|Scala|Rust|Data Mining|数据库|Oracle|Mysql|Sqlite|IOS|Data Mining|网络编程|多线程编程|Linux编程操作系统|计算机网络|留学生|编程|程序|代写|加急|个人代写|作业代写|Assignment