⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icarnegieinfoapplication.java

📁 JAVA编程 SSD3 UNIT1完全答案 满分作业!! CMU经典课程
💻 JAVA
字号:
import  java.io.*;
import  java.util.*;

public class ICarnegieInfoApplication
{

	private static BufferedReader  stdIn =
		new  BufferedReader(new  InputStreamReader(System.in));
	private static PrintWriter  stdOut =
		new  PrintWriter(System.out, true);
	private static PrintWriter  stdErr =
		new  PrintWriter(System.err, true);

	public static void main(String[]  args) throws IOException  {

		ICarnegieInfo companyInfo = ICarnegieInfo.getInstance();

		int  choice = getChoice();

		while (choice != 0)  {

			if (choice == 1)  {
				stdOut.println(companyInfo.getName());
			} 
			else if (choice == 2)  {
				stdOut.println(companyInfo.getAddress());
			}
			else if (choice == 3)  {
				stdOut.println(companyInfo.getTelephone());
			}
			else if (choice == 4)  {
				stdOut.println(companyInfo.getEmail());
			}
			else if (choice == 5)  {
				stdOut.println(companyInfo.getUrl());
			}

			choice = getChoice();
		}
	}

	private static int  getChoice() throws IOException 
	{

		/* PLACE YOUR CODE HERE */
		int choose = 0;
		do
		{
			stdErr.println( "0 – Quit" );
			stdErr.println( "1 – Display name" );
			stdErr.println( "2 – Display address" );
			stdErr.println( "3 – Display telephone" );
			stdErr.println( "4 – Display email" );
			stdErr.println( "5 – Display URL" );
			stdErr.println( "choice>" );
			try
			{
				choose = Integer.parseInt( stdIn.readLine() );
			}
			catch( NumberFormatException nFE )
			{
				stdErr.println( nFE.toString() );
			}

			if( choose > 5  || choose < 0  )
				stdErr.println( "Invalid Enter!" );
			
		}
		while ( choose > 5  || choose < 0 );
		
		if( 0 <= choose && choose <= 5 )
		{
			return choose;
		}
		else
			return 0;  /* CHANGE THIS STATEMENT AS NEEDED */
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -