这个程序运行得很好,但出于某种原因,当我要求输入名称时,它只会保存响应中的第一个单词.例如,如果我在稍后使用它输入"Jon Snow"时输出它将只显示"Jon".
import java.util.Scanner;
public class help
{
public static void main (String[] args)
{
Scanner input = new Scanner(System.in); //object for user input
//constant
final double tax = 0.08; //Sales tax
//variables
int choice; //menu selection/case switch
String name; //customer's name
String address; //customer's address
String email; //customer's email address
String item; //item purchased
double itemsPurchased; //number of items purchased
double itemPrice; //price of item purchased
double total; //total for purchase
double grandTotal; //total + tax
double taxAmount; //tax …Run Code Online (Sandbox Code Playgroud)