Find three run-time errors in the program

Assignment Help JAVA Programming
Reference no: EM131395118

1. What is the value of mystery after this sequence of statements?
int mystery = 1;
mystery = 1 - 2 * mystery;
mystery - mystery + 1;

2. What is wrong with the following sequence of statements?
int mystery 1;
mystery - mystery + 1;
int mystery 1 - 2 * mystery;

3. Write the following mathematical expressions in Java.

s = so + vot + 1/2 gt2

G = 4 Π2.a3/p2(m1 + m2)

FV = PV.(1 + INT/100)YRS

c = √(a2 + b2 - 2abcosγ)

4. Write the following Java expressions in mathematical notation.
a. dm . m * (Math.sqrt(1 + v / c) / Math.sqrt(1 - v / c) - 1);
b. volume = Math.PI * r * r * h;
c. volume = 4* Math.PI * Math.pow(r, 3) / 3;
d. z = Math.sqrt(x * x + y * Y);

5. What are the values of the following expressions? In each line, assume that

double x = 2.5;
double y = -1.5;

int m = 18;
int n = 4;

a. x + n * y- (x + n) * y
b. m /n + m%n
c. 5 * x - n / 5
d. 1 - (1 - (1 - (1 - (1 - n))))
e. Math.sqrt(Math.sqrt(n))

6. What are the values of the following expressions, assuming that n is 17 and m is 18?
a. n / 10 + n % 10
b. n % 2 + m % 2
C. (m + n) / 2
d. (m + n) / 2.0
e. (int) (0.5 * (m + n))
f. (int) Math.round(0.5 * (m + n))

7. What are the values of the following expressions? In each line, assume that
String s - "Hello";
String t "World";
a. s.length() + t.length()
b. s.substring(1, 2)
C. s.substring(s.length() / 2, s.length())
d.s + t
e. t + s

8. Find at least five compile-time errors in the following program.
public class HasErrors
public static void main();
{
System.out.print(Please enter two numbers:)
x in.readDouble;
y in.readDouble;
System.out.printline("The sum is " + x + y);
}
}

9. Find three run-time errors in the following program.
public class HasErrors
public static void main(String[] args)
{
int x - 0;
int y 0;
Scanner in - new Scanner("System.in");
System.out.print("Please enter an integer:");
x in.readInt();
System.out.print("Please enter another integer: ");
x in.readInt();
System.out.println("The sum is " + x + y);

}

Reference no: EM131395118

Questions Cloud

Really about serving the bottom of the pyramid : Was the Internet.org initiative really about serving the bottom of the pyramid or was it more about Facebook trying to expand its reach? Analyze.
Analyze two career options in the health care industry : Analyze two career options in the health care industry, in terms of the educational requirements, job responsibilities, and average salaries.Using the following Bureau of Labor Statistics Healthcare Occupations Website research two differences betwe..
What are the basic and non basic variables : Consider the partial simplex tableau shown below: In the tableau, what are the non basic variables? In the optimal tableau, what are the basic variables
Determine the absolute weight and the weight : determine the absolute weight and the weight relative to the rotating earth of a 9o-kg man if he is standing on the surfsce of the earth at a latitude of 40 degrees
Find three run-time errors in the program : Find three run-time errors in the program - What are the values of the following expressions and what is the value of mystery after this sequence of statements?
Form of argumentation - humans have feet : Determine whether each is strong or weak, and note the relationship between your answer and the truth or falsity of the premise(s) and conclusion.- Unlike monkeys, today's humans have feet that are not suited for grasping objects.
Companies in different industries : Going to google.com internet search to identify at least 2 companies in different industries that have entered into outsourcing agreements with firms with specialized services. In addition, describe what value chain activities the companies have ..
Determine the combined moment of the two 20-lb forces : The flexible shaft AB of the wrench is bent into a horizontal arc with a radius of 24 in. The two 20-lb forces, which are parallel to the z-axis, are applied to the handle CD, as shown.
Ethics and corporate scandal : In this assignment, you will analyze a corporate scandal by considering the leadership skills and competencies that were lacking in corporate leadership, and looking closely at the way the scandal was handled by leadership. Your work in this assig..

Reviews

len1395118

2/16/2017 12:09:07 AM

trying to do these qustions No of Pages/Words : 2 STANDARD LIBRARY ITEMS - java.io.PrintStream printf java.lang.Double parseDouble java.lang.Integer MAX_VALUE MIN_VALUE parselnt java.lang.Math PI abs cos exp log log10 max min pow round sin sqrt tan toDegrees toRadians java.lang.String charAt length substring java.lang.System in java.math.BigDecimal add multiply subtract java.math.Biglnteger add multiply subtract java.util.Scanner next nextDouble nextlnt javax.swing.)OptionPane showlnputDialog showMessageDialog

Write a Review

JAVA Programming Questions & Answers

  Write a menu-driven java program

Write a menu-driven JAVA program that performs the following array/vector operations:

  Littlest rebel starring shirley temple

Compare the novel Little Women by Louisa May Alcott and the film The Littlest Rebel starring Shirley Temple. How do these two intertwine or influence each other?

  How to use casscading style sheets to implement my web page.

I need to create links, buttons, and use java scripts. No Equations are involved. Although just alot of code.

  Payroll program that uses polymorphism

Write an employee payroll program that uses polymorphism to calculate and print the weekly payroll for your company.

  Extend the java defined hashmap class

Your goal is to extend the java defined HashMap class to add the ability to store multiple objects. To do this, you will edit MultiHashMap.java to both add new methods and override two methods from HashMap.

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Write a recursive method to produce a pattern

Write a recursive method to produce a pattern of n lines of asterisks.

  Write a method insert at that takes an array of integers

Write a method, insertAt, that takes four parameters: an array of integers; the length of the array; an integer, say, insertItem; and an integer, say, index

  Write a program to display the customer''s name

Write a program that prompts the salesperson for the name of the customer and the price of the textbooks sold to that customer.• The program should display the customer's name and the total compensation

  Write a program computehalf.java

Write a program ComputeHalf.Java that asks the user to a string. Write a method secondHalf that returns the second half of the input string.

  Write a java program to list odd numbers

Q1:Scenario: Write a Java program to list Odd numbers between 1 to any user given input number.Typical run of the program

  What is the purpose of the restrict keyword in c99

Arrays of strings in C and C++ can also be initialized with string literals. In this case, the array is one of pointers to characters.

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