• Java Problem: program that will ask the user which pencil to use in writing

    SapnaVishwas Member

    Can anyone Help me with this? I’m having a hard time coding

    Instruction: Create a program that will ask the user which pencil to use in writing.
    a. Graphite pencil. It can write a maximum of 50 characters.
    b. Mechanical pencil. It can write a maximum of 30 characters before can be refilled.
    c. Coloured pencil. It can write a maximum of 40 characters. The available colors are Red, Blue and Yellow.

    1. The user will choose which pencil he wants to use.
    Choose the pencil you want to use:
    [1] Graphite pencil
    [2] Mechanical pencil
    [3] Blue Coloured pencil
    [4] Red Coloured pencil
    [5] Yellow Coloured pencil Choice:

    2. The user will be asked repeatedly what to write until the he chooses to exit.

    Enter the text to write or enter q to exit:
    Note: The coloured pencil shall write the text like below.
    BLUE: [blue] TEXT [/blue]
    RED: [R]TEXT[/R]
    YELLOW: [Y]TEXT[/Y]

  • Ganesh Member

    use switch()

Viewing 1 reply thread
  • You must be logged in to reply to this topic.