Question: I need help with Zybooks Activity 2.1.9.1. For some reason Zybooks is very picky in the output according to the screenshot and need to know

I need help with Zybooks Activity 2.1.9.1. For some reason Zybooks is very picky in the output according to the screenshot and need to know if it's perfect and what needs changed. I asked my professor and the output looks like this. https://i.imgur.com/UXc0clJ.png The string "Howdy has a space and I cannot figure out why and it will give me an F if the code is not perfect format and everything. Please check over the code. Thanks.

Here is my code:

import java.util.Scanner; public class BasicInput { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userInt = 0; double userDouble = 0.0; char userChar = '-'; // FIXME Define char and string variables similarly String userString = ""; System.out.println("Enter Integer:"); userInt = scnr.nextInt(); // FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space System.out.println("Enter Double:"); userDouble = scnr.nextDouble(); System.out.println("Enter Character:"); userChar = scnr.next().charAt(0); System.out.println("Enter String:"); userString = scnr.nextLine(); System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString); // FIXME (2): Output the four values in reverse System.out.println(userString + " " + userChar + " " + userDouble + " " + userInt); // FIXME (3): Cast the double to an integer, and output that integer System.out.println(userDouble + " " + "cast to an integer is " + (int)userDouble); return; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!