Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question1: Please fix all the errors in the code below

public class Homework1 {

            public static void main(String[] args) {

                        int  i1 = 10;           // line1

                        double   d1 = 5.0;          // line2

                        float  f1 = 2.05;          // line3

                        char   c1 =  i1;          // line4

                        short   s1 = c1;          // line5

                        float  f2 = d1 / f1;          // line6

                        double d2 = f1 + i1 + c1;          // line7

                        float  f3 = d1 - i1;          // line8

                        byte b1 = 3;          // line9

                        byte b2 = 4;          // line10

                        byte b3 = 2 * b1 - b2;          // line11

            }

}

 

 

Question2: (25 points)            Calculate the value of d1 and d2:

            int i = 15;

            int j = 10;

            float f1 = 2;

            float d1 =  i / j;

            float d2 =  i / f1;

d1 =

d2 =

 

Question 3:

What is the value of a, b, i, j after the statements below are excuted.

int a = 10; 

int b = 5; 

int i =  ++a

int j = b--; 

a =

b =

i =

j=

 

Question 4:

What's the difference between continue and break?

 

 

 

 

Question 5:  

public class Example {

            public static void main(String[] args) {

                        int i = 1;

                        while (i <= 10) {

                                    i = i + 2;

                                    System.out.print(i + "  ");

                        }                     

            }

}

Output:

 

Question 6:  

public class Example {

            public static void main(String[] args) {

                        for (int k = 20; k >=10; k = k -3)  {

                        System.out.print(k + "  ");

                        }

            }

}

Output:

 

Question 7:

Please give an example to show value returning method and void method.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91602964
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

How to design a java program that reads a sentence say s

How to design a Java program that reads a sentence, say s, consisting of lower-case words with .nextLine() method, identifies the words using .indexOf() and .substring() methods and saves them in String variables. Then t ...

Question 1 identify the three main types of computer

Question: 1. Identify the three main types of computer software that were discussed in your unit lesson. Within the three main categories, give examples of each and a brief explanation of each. Each explanation/descripti ...

Suppose you roll a standard 6-sided die if you roll a 1 1

Suppose you roll a standard 6-sided die. If you roll a 1 (1), you randomly select one chip from a bowl containing 2 red (R) and 3 white (W) chips. If you don't roll a 1 (1 c ), you randomly select 1 chip from a bowl cont ...

Why regulated industries should be required to follow

Why regulated industries should be required to follow security standards. Provide 2 examples of industries that would fall under this category.

Give examples of how dominos has adapted its global

Give examples of how Domino's has adapted its global marketing mix to meet the needs of local consumers. Are you their customer? If so, why?

Under the trade model with external economies of scale is

Under the trade model with external economies of scale, is it possible for a country to be worse off with trade than it would have been without trade? Justify your answer.

Stacksthere are two main operations associated with stacks1

Stacks There are two main operations associated with stacks; 1) putting things on the stack which is referred to as push, 2) taking things from the stack which is referred to as pop. We can create a stack using linked li ...

Submit a report in which you plan a strategy for

Submit a report in which you plan a strategy for introducing or improving a mobile Web site in your organisation (or an organisation with which you are familiar). Your report must outline how your choice of strategy will ...

Question responsive frameworks and libraries provide

Question : Responsive frameworks and libraries provide convenience when creating a modern website. Discuss at least three design options, such as hiding content or layout changes, that would be beneficial for a responsiv ...

Qnbspvirtualbox aside what steps do you think are required

Q) VirtualBox aside, what steps do you think are required if we bought a brand new drive and plugged it into our system internally? a. Internally / externally, does it matter? b. If we plug it into the system, will it ju ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As