title-img


Java Stdin and Stdout II

In this challenge, you must read an integer, a double, and a String from stdin, then print the values according to the instructions in the Output Format section below. To make the problem a little easier, a portion of the code is provided for you in the editor. Note: We recommend completing Java Stdin and Stdout I before attempting this challenge. Input Format There are three lines of input: The first line contains an integer. The second line contains a double. The third line conta

View Solution →

Java Output Formatting

Java's System.out.printf function can be used to print formatted output. The purpose of this exercise is to test your understanding of formatting output using printf. To get you started, a portion of the solution is provided for you in the editor; you must format and print the input to complete the solution. Input Format Every line of input will contain a String followed by an integer. Each String will have a maximum of 10 alphabetic characters, and each integer will be in the inclusi

View Solution →

Java Loops I

Objective In this challenge, we're going to use loops to help us do some simple math. Task Given an integer, N, print its first 10 multiples. Each multiple N x i (where 1 <= i <=10 ) should be printed on a new line in the form: N x i = result. Input Format A single integer, N. Constraints 2 <= N <= 20 Output Format Print 10 lines of output; each line i (where 1 <= i <= 10 ) contains the result of N x i in the form: N x i = result. Sample Input 2 Sample Ou

View Solution →

Java Datatypes

Java has 8 primitive data types; char, boolean, byte, short, int, long, float, and double. For this exercise, we'll work with the primitives used to hold integer values (byte, short, int, and long): A byte is an 8-bit signed integer. A short is a 16-bit signed integer. An int is a 32-bit signed integer. A long is a 64-bit signed integer. Given an input integer, you must determine which primitive data types are capable of properly storing that input. To get you started, a portion of the

View Solution →

Java End-of-file

"In computing, End Of File (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source." — (Wikipedia: End-of-file) The challenge here is to read n lines of input until you reach EOF, then number and print all n lines of content. Hint: Java's Scanner.hasNext() method is helpful for this problem. Input Format Read some unknown n lines of input from stdin(System.in) until you reach EOF; each line of input contains a non-e

View Solution →