I am a uni student just starting out with java and getting more confused by the day. Can someone tell me what I have done wrong? It should input all of the strings and place them in the appropriate place in the bottom sentence.

import java.util.Scanner;  // Needed for the Scanner class

/**
 *   This program consist of just a single class.
 */
 
public class Words
{   
   public static void main(String[] args)
   {		
		// Create a Scanner object to read input.
		Scanner keyboard = new Scanner(System.in);
		
		// output program's purpose
		System.out.println("This is the `Word Game'\n");
		  
		// Get the first name of your unit coordinator
		System.out.print("Please enter the first name of your unit coordinator: ");
		String coordinator;	// name of the coordinator
		coordinator = keyboard.next();
		
		// User to their first name
		System.out.print("Please enter your first name: ");
		String name; // your name
		coordinator = keyboard.next();
		
		// Use to enter the name of a peice of food
		System.out.print("Please enter the name of a peice of food: ");
		String food; // the name of the food
		coordinator = keyboard.next();
		
		// Use to enter a number between 37 and 42
		System.out.print("Please enter a number between 37 and 42: ");
		String number; // your number
		coordinator = keyboard.next();
		
		// Use to enter an adjective
		System.out.print("Enter an adjective: ");
		String adjective; // your adjective
		coordinator = keyboard.next();
		
		//Use to enter a colour
		System.out.print("Please enter a colour: ");
		String colour; // your colour
		coordinator = keyboard.next();
		
		//Use to enter the name an animal
		System.out.print("Please enter the name of a animal: ");
		String animal; // an animals name
		coordinator = keyboard.next();
	
		//Display full paragraph with string data
		System.out.println (Dear " + coordinator, + " I am sorry that I am unable to turn in my assignment on time.
First, I ate a rotten " + food + ", which made me turn " + colour + " and
extremely ill. I came down with a fever of " + number + " degrees.
Next," + my adjective + " pet " + animal + " must have smelled the remains
of the " + food + " on my assignment, because he ate it. I am currently
rewriting my assignment and hope you will accept it late. 


Sincerely, " + name + "		 ");
		

	
	 } // end of main
	 } // end of class Match

Recommended Answers

All 2 Replies

how do you know it's doing something wrong? what is your expected output and what do you get? which error messages do you get?

coordinator = keyboard.next();

You initialized coordinator 7 times. ;)

//Display full paragraph with string data

Print each line. :)

System.out.println ("Dear " + coordinator, + " I am sorry that I am unable to turn in my assignment on time.");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.