(1) 實現一個Point類,該類包含表示坐標的兩個int型變量x、y,構造方法Point()和Point(int xx, int yy),返回x值和y值的int getX()和int getY()方法,計算兩點間距離的double distance(Point)方法。其中計算平方根用Math.sqrt()方法。 (2) 實現一個Circle類,該類包含表示圓心的Point型變量center,表示半徑的int radius變量,以及構造方法Circle()、Circle(int xx,int yy,int r)、Circle(Point c,int r),返回周長和面積的int perimeter()、double area()方法,返回兩個圓是否為同一個圓(返回0)、同心圓(返回1)、相交的圓(返回2)、分離的圓(返回3)、包含的圓(返回4)等關系的int relation(Circle c)等方法。PI值可以用Math.PI常量。 (3) 實現測試上述兩個類的ClassTest類。該類在main方法中分別創建若干個Point對象和Circle對象,并調用相關方法,輸出方法的返回值,驗證其正確性。 (4) 將Point類、Circle類和主類的包名分別調整為p1、p2、p3,并重新運行,驗證是否運行正確。
標簽: Point
上傳時間: 2014-11-25
上傳用戶:cylnpy
//通過18B20檢測的數字溫度可在電腦上顯示當前溫度值 #include <reg52.h> #define uchar unsigned char #define uint unsigned int sbit DS=P2^2 //define interface uint temp // variable of temperature uchar flag1 // sign of the result positive or negative sbit dula=P2^6 sbit wela=P2^7
標簽: define unsigned include 18B20
上傳時間: 2014-01-19
上傳用戶:Andy123456
//1602液晶顯示字屏為:TX-1C MCU GOTOYUNLONGDZ #include<reg52.h> #define uchar unsigned char #define uint unsigned int
標簽: GOTOYUNLONGDZ unsigned include define
上傳時間: 2014-11-14
上傳用戶:caiiicc
#include <stc12c2052AD.H>// 標準庫的頭文件 #include <intrins.h> #include <absacc.h> #define uchar unsigned char #define uint unsigned int
上傳時間: 2016-08-29
上傳用戶:rocwangdp
java 對string的各種函數,如跟int,byte的數據類型的轉換,編碼的轉換等。
上傳時間: 2013-12-18
上傳用戶:牛津鞋
void InitGoertzel(void) 作用:初始化算法參數 用法:采用算法進行檢測前執行一次,如果需要改變參數,調用SetParameter() float CGoertzel::GetMagnitude(unsigned char * sampleData, int length) //算法主接口 作用:對采集下來的音頻數據用算法處理,返回一個結果 參數:sampleData-音頻數據緩沖地址指針; length-緩沖區尺寸(音頻數據數量),字節數; 返回值:返回算法結果。 void SetParameter(DWORD set_SampleRate, DWORD set_TargetFreq, DWORD set_BlockSize) 作用:設置算法參數; 參數:set_SampleRate-音頻數據抽樣速率; set_TargetFreq-目標信號頻率; set_BlockSize-算法數據塊尺寸(采樣點); 用法:調用本函數后,需要調用一次InitGoertzel(void)才會生效
標簽: void InitGoertzel 算法 初始化
上傳時間: 2016-09-20
上傳用戶:sssl
在編制鍵盤輸入程序時常常要用到一個鍵的掃描碼或ASC碼,如用到 Foxpro 的 inkey() 函數,以及用到 BIOS 的 int 16H時,但找一個編碼表不太容易,有時候找到的編碼表又不全,無法查到組合鍵的編碼,本程序就是一個隨時用來顯示按鍵的ASC碼及掃描碼的程序,可以用 16 進制和 10 進制同時顯示一個鍵按下和放開的掃描碼,以及ASC碼,同樣也支持組合鍵。
上傳時間: 2016-09-21
上傳用戶:釣鰲牧馬
讀取配置文件(ini格式)的程序,可返回int,char*,float類型等的配置項數值。
上傳時間: 2016-10-02
上傳用戶:as275944189
C/C++Compiler Suite 2.1 for converting MATLAB applications that contain math, GUIs, and graphics into freely distributable stand-alone C and C++ code
標簽: applications converting Compiler graphics
上傳時間: 2013-12-18
上傳用戶:498732662
To find and output 11-999 between the number of m, it is to meet m, m2 and m3 are several palindrome. The so-called palindrome refers to the number of its symmetrical figures that the whole number, for example, 121,676,94249 and so on. To meet the above requirements, such as the number of m = 11, m2 = 121, m3 = 1331 palindrome are few. Please prepare function int svalue (long m) to achieve this function, if it is palindrome, is a function to return, while return 0.
標簽: palindrome and between several
上傳時間: 2013-12-27
上傳用戶:二驅蚊器