Difference in computer program and programming a computer

Assignment Help Basic Computer Science
Reference no: EM13765318

Question1:

1.1 Explain the difference between using a computer program and programming a computer.

1.2 How do you discover syntax errors? How do you discover logic errors?

1.3 What is the difference between object and object reference?

1.4 Explain the difference between an object and a class.

1.5 What is the difference between equality and assignment?

1.6 What is the difference between a reserved word and an identifier?

1.7 What is the implicit parameter? Explain with example.

1.8 Write a java statement to convert a string str to a double.

Question 2

2.1 Which of the following are legal identifiers? why?

Greeting1 g void 104IT IT104
Hello,
World
Hello3World

2.2 Construct a logical expression to represent each of the following conditions:

a. x is between 3 and 15 but not equal to 10.

b. x is between 10 and 20 but not odd.

c. y is divisible by 5 but not by 40.

d. str is a lowercase or uppercase letter.

2.3 What is the difference between the following two statements?

a. if (n > 2) { if (n < 6) System.out.println("Done!"); }

else System.out.println("Error");

b. if (n > 2) { if (n < 6) System.out.println("Done!");

else System.out.println("Error"); }2.4 What is the difference between the result of the following two statements?

a. int cents = (int)(100 * price + 0.5);

b. int cents = (100 * price + 0.5);

Question 3

3.1 Write an Algorithm to decide which is cheaper car or bus for a travel:

You want to decide whether you should drive your car to work or take the bus.

You know the one-way distance from your home to your place of work, and the fuel efficiency of your car (in miles per gallon). You also know the one-way price of a train ticket. You assume the cost of gas at $4 per gallon, and car maintenance at 5 cents per mile. Write an algorithm to decide which commute is cheaper.

3.2 Use string concatenation only to complete the following program so that it prints the message "the quick white tiger jumps over the small dog".

public class ConcatDemo
{
public static void main(String[] args)
{
String animal1 = "quick white tiger";
String animal2 = "small dog";
String article = "the";
String action = "jumps over";

/* Your work goes here */

System.out.println(message);

}
}

3.3 Find the output of the following code when the user enters 100 and when the user enters AQ:

public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Enter somthing: ");
String str = in.next();
int count = Integer.parseInt(str);
System.out.println("Input is " + count);
}

Question 4

4.1 Write a program that simulates a simple calculator. It reads two integers and a character. If the character is a +, the sum is printed; if it is a -, the difference is printed; if it is a *, the product is printed; if it is a /, the quotient is printed; and if it is a %, the remainder is printed.

4.2 In the 2- dimensional plane, a point is described by its two coordinates x and y. It supports these operations:

  • A constructor allowing initialization of both coordinates
  • Accessors and mutators to its coordinates
  • Translation of a point

a. Write a java class, called MyPoint, that corresponds to such an abstraction of points in the dimensional plane.
b. Provide a tester class that creates one point, then translates and displays its new coordinates

Reference no: EM13765318

Questions Cloud

Describe characteristics of an effective paralegal : Determine three (3) most important characteristics of an effective paralegal. Justify your response
Recognition of profit and balance sheet amounts : Harman Construction Company began operations January 1, 2014. During the year, Harman Construction entered into a contract with Kardon Corp. to construct a retail showcase facility.
Long-term contract reporting : Bearing Construction Company began operations in 2014. Construction activity for the first year is shown below. All contracts are with different customers, and any work remaining at December 31, 2014, is expected to be completed by the end of 2015..
Installment-sales method calculations-entries : Mandarin Partners appropriately uses the installment-sales method of accounting to recognize income in its financial statements. The following information is available for 2014 and 2015.
Difference in computer program and programming a computer : Explain the difference between using a computer program and programming a computer. How do you discover syntax errors. How do you discover logic errors. What is the difference between object and object reference
Compare the life of cabestaing with boccaccios story : Compare the Life of Cabestaing with Boccaccio's story. Note Boccaccio's changes and discuss the significance of them.
Compare and contrast the termsdisparity and discrimination : Write a 700- to 1,050-word essay in which you compare and contrast the termsdisparity and discrimination as they relate to the criminal justice system
Analysis of installment-sales accounts : Republic Distributors. appropriately uses the installment-sales method of accounting. On December 31, 2014, the books show balances as follows.
Arguments for and against race-based jury nullification : Summarize the arguments for and against race-based jury nullification. Include contemporary examples of race-based jury nullification

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write and explain briefly three guidelines for sound policy

Write and explain briefly three guidelines for sound policy, as stated by Bergeron and Bérubé. Are policies different from standards? In what way? Are policies different from procedures? In what way?

  What know by statement mydog setname bowser

what do you know by the following statement: myDog.setName("Bowser")

  What is data integrity and in what way it is implemented

What is data integrity and in what way it is implemented in DBMS MS Access

  Given a set of n points in the cartesian plane

Design an algorithm for the following problem: Given a set of n points in the Cartesian plane, determine whether all of them lie on the same circumference

  Specify the most significant advantages and disadvantages

Specify the most significant advantages and disadvantages that could be realized by the organization in adopting a server virtualization infrastructure. Prepare a plan for implementing Hyper-V (or an alternate solution, such as VMware) as a solution ..

  Convert number f(t) decaying each minute to the number r(t)

Radioactive carbon 11 has a decay rate k of 0.0338 per minute-that is, a particular C11 atom has a 3.38% chance of decaying in any one minute. Suppose we start with 100 such atoms.

  Computing characters are there in encyclopedia

The text of the Encyclopedia Britannica is about 44 million words. For a sample of about 2000 words, the average word length was 6.1 characters per word. Approximately how many characters are there in the encyclopedia?

  Pricing in one market depends on sales

12. A firm makes two products, x and y. Inverse demand for each shows that pricing in one market depends on sales in the other according to the equation:Px=1000 - 20x + 3y and Py = 500 - 5y + x.The firm faces joint fixed cost of $12,000 and constant ..

  Executive management providing

A four-paragraph executive summary written to executive management providing a summary of findings, risk impact to the IT asset and organization, and recommendations for next steps.

  How code an interactive hangman game using string method

How do you code an interactive hangman game using the string method

  Compare computerized process to manual process

ompare a computerized process to manual process. Write differences and the advantages and disadvantages of the computerized systems.

  Explain what is done to prevent wayward system administrator

Explain what can be done to prevent wayward system administrators from simply looking up user passwords in host machine password file?

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