What is the value of sum after this code sequence is execute

Assignment Help JAVA Programming
Reference no: EM13940017

1. What is the output of this code sequence? (The user successively enters 3, 5, and -1.)

System.out.print( "Enter an int > " );
int i = scan.nextInt( );
while ( i !=-1 )
{
System.out.println( "Hello" );
System.out.print( " Enter an int > " );
i = scan.nextint ( );
}

2. what are the values of i and product after this code sequence is executed?

int i=6;
int product =1;
do
{
product *=i;
i++;
}while ( i <9 );

3. What is the output of this code sequence?

for ( int i = 0; i <3; i++ )
System.out.println( "Hello" );
System.out.println( " Done" );

4. What are the values of i and sum after this code sequence is executed?

int i = 0;
int sum = 0;
for ( i =0; i < 5; i++ )
{
sum += i;
}

5. What is the value of sum after this code sequence is executed?

int sum = 0;
for ( int i = 1; i < 10; i++ )
{
i++;
sum += i;
}

Reference no: EM13940017

Questions Cloud

Discuss the effects of climate change on the ecology : Discuss the effects of climate change on the ecology, community and economy of Canada.Present a structured report of between 2500 and 3000 words, written in appropriate language and referenced (using APA6), so that the average concerned resident o..
Is it ethical to charge such high rates of interest : How should a manager balance the need of low-income individuals to buy goods on credit with the need of businesses to make a profit? Is it ethical to charge such high rates of interest? Should there be a limit to what a seller can charge for credi..
Are there any legal and ethical ramifications of this case : Are there any legal and ethical ramifications of this case? If so, what? If not, why? Should U.S. companies sell products banned in the United States to other countries? Why or why not? Discuss fully and cite sources that support your response.
Differences of absorption and variable costing : Discuss the advantages and disadvantages of absorption and marginal costing and what factors organisations are required to consider when using each of these methods
What is the value of sum after this code sequence is execute : What are the values of i and sum after this code sequence is executed?
What are the benefits and risks of e-commerce for company : Evaluate how e-commerce affects your company. You can consider the following questions: What are the benefits and risks of e-commerce for your company? How should your company prepare for the risks
Challenges and opportunities in information systems : Identify and explore contemporary challenges and opportunities in information systems and to formulate an opinion or judgement and offer possible solutions.
Discuss the facts of the case from your client perspective : To provide for more uniformity in the case briefs, consider the following format for your case briefs: Parties: Identify your party, plaintiff or defendant. Facts: Discuss the facts of the case from your client's perspective
The average cost to attend the university : After deducting grants based on need, the average cost to attend the University of Southern California is $27,175. Assume the population standard deviation is $7400. Suppose that a random sample of 60 USC students will be taken from this populatio..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a game of tic-tac-toe

Specify, design, and implement a class that can be one player in a Game of tic-tac-toe. The constructor should be specify whether the object is to be the first player (X's) or the second player (O's).

  Loops and files

Convert an algorithm using control structures into Java and write a while loop

  Create a class called employee with name idno address and

create a class called employee with name idno address and phone number as attributes. create the setter and getter

  Create a constant to hold the desired duration of workout

Creates an instance of the FiFiWorkout.java class. Gets input for first name. Create a constant to hold the desired duration of workout. Set it to 30.

  Implement a class called reversewords

Implement a class called ReverseWords that uses a stack to output a set of elements input by the user in reverse order.

  Part-11 exceptions and exception handlinggt create a java

part-11 exceptions and exception handlinggt create a java class called samearraysexception that extends the exception

  Design a java program that simulates a slot machine

Design a java program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. ? Instead of displaying images, the program will random..

  Design and implement a small and simple email server using

design and implement a small and simple email server using the concept of web based information system. your system

  Calculates the cutoff frequency in a simple rc circuit

Write a simple Java application which calculates the cutoff frequency in a simple RC circuit

  Concept of time in javascript

In JavaScript a time is dened as a Date Object. Each date object stores its state as a time value,which is a primitive number that encodes a date.

  Creating an application that accepts product data

You have been tasked with creating an application that accepts product data and displays this information. The application also computes average sales and shipping charges

  Create a java gui application using netbeans

Create a Java GUI application using Netbeans that allows the user to enter the number of hours spent in each activity and then calculates the number of pounds lost.

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