Java Assignment Help.
#1

I have Assignment that must be submitted by tomorrow, i was able to solve 4 of the 5 questions.
Well, i am stuck in this

Код:
Write a program that reads in from the user an integer (num) between 1000 and 9999. Then it prompts
the user to enter an integer (d) between 0 and 9 and a character (ch). Your program should replace the 
second and the last digit in num with d and it should display the character that precedes (ch) followed by 
the number after the change and then the character that comes after (ch). Use the division and modulus 
operators to extract the digits from num.

Sample run:

Enter an integer between 1000 and 9999: 2134
Enter a digit (between 0 and 9): 6
Enter a character: b
Number was 2134. Result: a2636c.
and this what i did for now

Код:
package question2;
import java.util.Scanner;

public class Question2 {
   
  public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    System.out.println("Enter an integer between 1000 and 9999: ");
    int num = input.nextInt();
    System.out.println("Enter a digit (between 0 and 9): ");
    int d = input.nextInt();
    System.out.println("Enter a character: ");
    double ch = input.nextDouble();
        
   }
    
}
Anyone knows how to solve it?
Reply


Messages In This Thread
Java Assignment Help. - by ColonelBurton - 01.11.2014, 16:35
Re: Java Assignment Help. - by Mauzen - 01.11.2014, 17:09
Re: Java Assignment Help. - by ColonelBurton - 01.11.2014, 19:15
Re: Java Assignment Help. - by IvanSb - 01.11.2014, 19:34
Re: Java Assignment Help. - by RaZVaN ^ xD - 02.11.2014, 00:28
Re: Java Assignment Help. - by Mauzen - 02.11.2014, 00:52
Re: Java Assignment Help. - by BroZeus - 02.11.2014, 08:07
Re: Java Assignment Help. - by Infinity - 02.11.2014, 08:17
Re: Java Assignment Help. - by BroZeus - 02.11.2014, 08:37
Re: Java Assignment Help. - by Infinity - 02.11.2014, 10:28

Forum Jump:


Users browsing this thread: 2 Guest(s)