Finding example of source code

Assignment Help Software Engineering
Reference no: EM1378980

Question1. Find one example of each label in the following source code and write the line number of the example next to the label.

a. Instance variable

b. Class variable :

c. Instance method

d. Class method

e. Constant variable

f. Constructor

g. Import statement :

1: package edu.gmu.cs.geom;
2:
3: import edu.gmu.cs.geom.Translatable;
4:
5: public class Point2d implements Translatable {
6:
7: public static int ORIGIN_X = 0;
8: public static int ORIGIN_Y = 0;
9:
10: private int x;
11: private int y;
12:
13: public Point2d() {
14: this.x = Point2d.ORIGIN_X;
15: this.y = Point2d.ORIGIN_Y;
16: }
17:
18: public Point2d(int x, int y) {
19: this.x = x;
20: this.y = y;
21: }
22:
23: public int getX() {
24: return this.x;
25: }
26:
27: public int getY() {
28: return this.y;
29: }
30:
31: public void translate(int xDelta, int yDelta) {
32: this.x += xDelta;
33: this.y += yDelta;
34: }
35:
36: public static Point2d add(Point2d left, Point2d right) {
37: int x = left.getX() + right.getX();
38: int y = left.getY() + right.getY();
39:
40: return new Point2d(x, y);
41: }
42:
43: }

2. Order the following code segments by time complexity in ascending order. For bonus points, show the runtime of each code segment in Big O notation.

a.

for (int y = 0; y < n; y++) {
for (int x = 0; x < n; x++) {
m[y, x] = 0;
}
}

b.

public boolean isOdd(int x) {
return (x % 2) == 0;
}

c.

int x = 0;
int y = 0;

while (x < MAX) {
if (isOdd(x)) {
x++;
y++;
} else {
x++;
}
}

d.

int sum = 0;
for (int i = 0; i < items.size(); i = (i * 2) + 1) {
sum += items.get(i);
}

 

Reference no: EM1378980

Questions Cloud

Re usability in object oriented languages : Re-usability is ability to use code written for another condition. Most languages and programming paradigms support re-usability in some form.
Suggestions for viable guidelines : Do you think that variations in company and societal culture could pose a significant problem when coordinating or scheduling large assignments,
Project communications planning : Determine what aspects of your assignment communications planning would you adapt for large-scale transnational IT projects in which the project teams.
Writing and executing an insert statement : Make yourself a student by writing and executing an INSERT statement to insert a row into the STUDENT table with information about you.
Finding example of source code : Discover one example of each label in the following source code and write the line number of the example next to the label.
Process of formal software testing : Discuss and explain software testing as a career path, and consider what skills would be desirable for a software tester.
Develop a disease surveillance algorithm for hiv : Write a 2 page paper in which you analyze the cost, functionality, timeframe, and social, political, environmental, and economic elements of your designed HIV/AIDS disease surveillance system.
Question about c programming : Construct a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000.
Solving linear equations and linear inequalities : Discuss briefly and explain software testing as a career path, what skills would be desirable for a software tester.

Reviews

Write a Review

Software Engineering Questions & Answers

  Prepare a business case for project

Business Case - Using the information that you compiled in the project proposal, prepare a Business Case for this project.

  List diffent entities or objects and logical processes

List the diffent entities or objects,logical processes,data flows, and dfata stores that are involoved. starting from the time you submitted your time sheet.

  Designing e-r diagram for each product at pvf

Suppose that at PVF, each product. Design E-R diagram for this situation and state minimum and maximum cardinalities on the diagram.

  Create flowchart of major steps for development processes

Consider the design development process. Create flowchart of major steps, processes, and milestones essential to conduct thorough DBMS design.

  Relationship of application development methodologies-models

Explain the relationships between application development methodologies, models, and tools. Compare and contrast the various generations of programming languages.

  Design algorithm to find clique in graph

Design an O(n9) algorithm to find a 9-clique in G, if such clique exists; answer "no such a clique" if it does not exist. Please describe your algorithm and sketch its correctness. Pseudocode is NOT required.

  Explanations on fixing c++ code errors

This technique takes an array of ints as a parameter and returns an array of Booleans. For each element in the parameter array whose value is 0,

  Create data flow diagram about process

Create a data flow diagram about the process. When John received orders from the sales department, he would pick the items from the warehouse to fill up the order.

  Produce set of crc cards-uml diagram-javadoc comments

Produce a set of CRC cards, a UML diagram, and a set of javadoc comments (detailed JavaDoc only for each method created, no coding required).

  Modularity can have negative as well as positive effect

Modularity can have a negative as well as a positive effect. A program that is overmodularized performs its operations in very small modules, so a reader has trouble acquiring an overall perspective

  What is the need to identify test deliverables

What is a test plan? List out the processes that are covered in a test plan. What is the need to identify test deliverables?

  Describe five forces of porter-s competitive forces model

Describe each of the five forces of Porter's competitive forces model and explain how Internet impacts each one. List and explain each of the six steps of knowledge management system cycle.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd