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

📄 timetable.java

📁 tutorial solutions for java programing
💻 JAVA
字号:
// Exercise 3.8
public class TimeTable { //saved as "TimeTable.java"
	public static void main (String[] args) {
		
		//display the number title
		System.out.print(" * |");
		for(int TitleCol = 1; TitleCol <= 9; TitleCol++){
			System.out.printf("%3d", TitleCol);
		}
		System.out.println();
		System.out.println("-------------------------------");
		
		//print the table body
		for(int row = 1; row <= 9; row++){
			System.out.printf("%2d |", row);
			//display the products and align properly
			for(int col = 1; col <= 9; col++){
				System.out.printf("%3d", row*col);
			}
			System.out.println();
		}
		
		//time table from 1 to 12
		
		//display the number title
		/*System.out.print("  * |");
		for(int TitleCol = 1; TitleCol <= 12; TitleCol++){
			System.out.printf("%4d", TitleCol);
		}
		System.out.println();
		System.out.println("-----------------------------------------------------");
		
		//print the table body
		for(int row = 1; row <= 12; row++){
			System.out.printf("%3d |", row);
			//display the products and align properly
			for(int col = 1; col <= 12; col++){
				System.out.printf("%4d", row*col);
			}
			System.out.println();
		}*/
		
	}
}

⌨️ 快捷键说明

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