Tag: Java

Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”.

Assume that name is a variable of type String that has been assigned a value.  Write an expression whose value is a String containing the last character of the value of name.  So if the value of name were “Smith” the expression’s value would be “h”.

LANGUAGE:  JAVA CHALLENGE: Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”....

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Assume that name has been declared suitably for storing names (like “Amy”, “Fritz” and “Moustafa”)

Assume that name has been declared suitably for storing names (like “Amy”, “Fritz” and “Moustafa”)

LANGUAGE:  JAVA CHALLENGE: Assume that name has been declared suitably for storing names (like “Amy”, “Fritz” and “Moustafa”). Assume also that stdin is a variable that references a Scanner object associated with standard input. Write some code that reads a value into name then prints the message “Greetings, NAMEVALUE!!!” on a line by itself where...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile.

Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile.

LANGUAGE:  JAVA CHALLENGE: Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile....

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that writes both of their values to standard output in the following format

Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that writes both of their values to standard output in the following format

LANGUAGE:  JAVA CHALLENGE: The exercise instructions here are LONG — please read them all carefully. If you see an internal scrollbar to the right of these instructions, be sure to scroll down to read everything. Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Assume the existence of a Widget class that implements the Comparable interface and thus has a compareTo method that accepts an Object parameter and returns an int. Write an efficient static method, getWidgetMatch, that has two parameters.

Assume the existence of a Widget class that implements the Comparable interface and thus has a compareTo method that accepts an Object parameter and returns an int.   Write an efficient static method, getWidgetMatch, that has two parameters.

LANGUAGE: JAVA CHALLENGE: Assume the existence of a Widget class that implements the Comparable interface and thus has a compareTo method that accepts an Object parameter and returns an int. Write an efficient static method, getWidgetMatch, that has two parameters. The first parameter is a reference to a Widget object. The second parameter is a potentially...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15.

Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15.

LANGUAGE: JAVA CHALLENGE: 19. Squares. Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using the character ‘X’. The number entered by the user will be the length of each side of the square. For example, if...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. A boolean variable named recalled has been declared. Given a variable modelYear write a statement that assigns true to recalled if the value of modelYear falls within the recall range and assigns false otherwise.

Clunker Motors Inc. is recalling all vehicles from model years 2001-2006.  A boolean variable  named recalled has been declared. Given a variable modelYear write a statement that assigns  true  to recalled if the value of modelYear falls within the recall range and assigns false  otherwise.

LANGUAGE: Java CHALLENGE: Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. A boolean variable named recalled has been declared. Given a variable modelYear write a statement that assigns true to recalled if the value of modelYear falls within the recall range and assigns false otherwise. Do not use an if statement in this...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Given an initialized String variable output , write an expression whose value is a reference to a newly created PrintWriter object associated with a file whose name is contained in output . (Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

Given an initialized String variable output , write an expression whose value is a reference to a newly created PrintWriter object associated with a file whose name is contained in output . (Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

LANGUAGE: JAVA CHALLENGE: Given an initialized String variable output , write an expression whose value is a reference to a newly created PrintWriter object associated with a file whose name is contained in output . (Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Declare two double variables, one named length with a value of 3.5 and the other named width with a value of 1.55

Declare two double variables, one named length with a value of 3.5 and the other named width with a value of 1.55

LANGUAGE: Java CHALLENGE: Declare two double variables, one named length with a value of 3.5 and the other named width with a value of 1.55...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More