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

java

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

Read More

Write an expression whose value is a reference to a newly created PrintWriter object associated with a file named “message.log”. The PrintWriter object should be created so that existing content in the file is not destroyed or overwritten, but rather output will be appended to any existing content.(Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

java

Write an expression whose value is a reference to a newly created PrintWriter object associated with a file named “message.log”. The b>PrintWriter object should be created so that existing content in the file is not destroyed or overwritten, but rather output will be appended to any existing content.(Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

Read More

Given a Scanner reference variable, stdin, that is associated with standard input, read in two words. Use the first word as the name of a file to create and store the second word in. Make sure that the data written to the file has been flushed from its buffer and that any system resources used during the course of running these statements have been released. (Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

java

Given a Scanner reference variable, stdin, that is associated with standard input, read in two words. Use the first word as the name of a file to create and store the second word in. Make sure that the data written to the file has been flushed from its buffer and that any system resources used during the course of running these statements have been released. (Do not concern yourself with any possible exceptions here– assume they are handled elsewhere.)

Read More

Given a PrintWriter reference variable named output that references a PrintWriter object, write a statement that flushes any buffered output on the stream associated with the object, releases any system resources associated with the object and ceases output operations on the associated stream.

java

Given a PrintWriter reference variable named output that references a PrintWriter object, write a statement that flushes any buffered output on the stream associated with the object, releases any system resources associated with the object and ceases output operations on the associated stream.

Read More

Suppose that the tuition for a university is $10,000 this year and increases 5% every year. In one year, the tuition will be $10,500. Write a program that displays the tuition in 10 years and the total cost of 4 years worth of tuition starting after the 10th year.

Suppose that the tuition for a university is $10,000 this year and increases 5% every year. In one year, the tuition will be $10,500. Write a program that displays the tuition in 10 years and the total cost of 4 years’ worth of tuition starting after the 10th year.

Read More