Marketplace

Related Articles

More

Related Categories

Recently Added

More

Join StudyUp.com Today

It's always free and anyone can join!

Watch StudyUp Demo Video Now

You Recently Visited

Simple Writing Prompts

Ramona Said:

How do I write a simple java program that prompts the user to input an integer between 0 and 35?

We Answered:

import java.util.Scanner;

public class ZeroThirtyFive {

public static void main(String[] args) {
//Create scanner
Scanner input = new Scanner(System.in);
//char array of alphabet
char[] alphabet = {
'A','B','C','D','E','F','G','H','I… 'J','K','L','M',
'N','O','P','Q', 'R','S','T','U','V','W','X' ,'Y','Z'
};

//Ask user for input, store in num variable
System.out.println("Enter a number between 0 and 35");
int num = input.nextInt();

//Check if number is between 0 and 35, if not it outputs that it was not between those numbers
if((num >= 0)&&(num <= 35)){
//If less than 9, print that number
if(num <= 9){
System.out.println(num);
}
//Else print letter = number using alphabet array
else{
int place = 0;//Need this because i starts at 10, so i won't loop through alphabet array properly
for(int i = 10; i <= 34; i++){
System.out.print( alphabet[place]+ "="+i+", ");
place++;
}
System.out.print(alphabet[25]+ "="+35);//Print last one without a comma at the end
}
}
else{
System.out.println("Didn't enter a number between 0 and 35");
}
}
}

Lance Said:

Can someone give me a simple writing prompt please?

We Answered:

Your town is in need of new schools. Your state has agreed to grant your town 80% of the money needed to build them. To cover the last 20%, local taxes would increase. Each household would have to pay about $1,000 spread out over the next 15 years. State the pros and cons and choose your position on whether or not they should be built.

Discuss It!