第十三章习题答案final
java英文(第八版)十三章答案

import java.util.Scanner;public class Exercise13_2 {public static void main(String[] args) {Scanner input = new Scanner(System.in);boolean done = false;int number1 = 0;int number2 = 0;// Enter two integersSystem.out.print("Enter two integers: ");while (!done) {try {number1 = input.nextInt();number2 = input.nextInt();done = true;}catch (Exception ex) {System.out.print("Incorrect input and re-enter two integers: ");input.nextLine(); // Discard input}}System.out.println("Sum is " + (number1 + number2));}}public class Exercise13_4{public static void main(String[] args) {try {new NewLoan(7.5, 30, 100000);NewLoan m = new NewLoan(-1, 3, 3);new NewLoan(7.5, 30, 20000);}catch (Exception ex){System.out.println(ex);}System.out.println("End of program");}}class NewLoan {private double annualInterestRate;private int numOfYears;private double loanAmount;/** Default constructor */public NewLoan() {this(7.5, 30, 100000);}/** Construct a NewLoan with specified annual interest rate,number of years and loan amount*/public NewLoan(double annualInterestRate, int numOfYears,double loanAmount) {if (annualInterestRate <= 0)throw new IllegalArgumentException("Annual interest rate must be positive.");if (numOfYears <= 0)throw new IllegalArgumentException("Number of years must be positive.");if (loanAmount <= 0)throw new IllegalArgumentException("Loan amount must be positive."); setAnnualInterestRate(annualInterestRate);setNumOfYears(numOfYears);setLoanAmount(loanAmount);}/** Return annualInterestRate */public double getAnnualInterestRate() {return annualInterestRate;}/** Set a new annualInterestRate */public void setAnnualInterestRate(double annualInterestRate) {if (annualInterestRate <= 0)throw new IllegalArgumentException("Annual interest rate must be positive.");this.annualInterestRate = annualInterestRate;}/** Return numOfYears */public int getNumOfYears() {return numOfYears;}/** Set a new numOfYears */public void setNumOfYears(int numOfYears){if (numOfYears <= 0)throw new IllegalArgumentException("Number of years must be positive.");this.numOfYears = numOfYears;}/** Return loanAmount */public double getLoanAmount() {return loanAmount;}/** Set a newloanAmount */public void setLoanAmount(double loanAmount) {if (loanAmount <= 0)throw new IllegalArgumentException("Loan amount must be positive.");this.loanAmount = loanAmount;}/** Find monthly payment */public double monthlyPayment() {double monthlyInterestRate = annualInterestRate / 1200;return loanAmount * monthlyInterestRate / (1 -(Math.pow(1 / (1 + monthlyInterestRate), numOfYears * 12)));}/** Find total payment */public double totalPayment() {return monthlyPayment() * numOfYears * 12;}}public class Exercise13_6 {public static void main(String[] args) {System.out.println(parseHex("A5"));System.out.println(parseHex("FAA"));System.out.println(parseHex("T10"));System.out.println(parseHex("ABC"));System.out.println(parseHex("10A"));}public static int parseHex(String hexString) {int value = convertHexToDec(hexString.charAt(0));for (int i = 1; i < hexString.length(); i++) {value = value * 16 + hexString.charAt(i) - '0';}return value;}static int convertHexToDec(char ch) {if (ch == 'A') {return 10;}else if (ch == 'B') {return 11;}else if (ch == 'C') {return 12;}else if (ch == 'D') {return 13;}else if (ch == 'E') {return 14;}else if (ch == 'F') {return 15;}else if (ch <= '9' && ch >= '0')return ch - '0';elsethrow new NumberFormatException("Illegal character: " + ch);}}public class Exercise13_8 {public static void main(String[] args) throws HexFormatException {System.out.println(parseHex("A5"));System.out.println(parseHex("FAA"));System.out.println(parseHex("T10"));System.out.println(parseHex("ABC"));System.out.println(parseHex("10A"));}public static int parseHex(String hexString) throws HexFormatException { int value = convertHexToDec(hexString.charAt(0));for (int i = 1; i < hexString.length(); i++) {value = value * 16 + hexString.charAt(i) - '0';}return value;}static int convertHexToDec(char ch) throws HexFormatException {if (ch == 'A') {return 10;}else if (ch == 'B') {return 11;}else if (ch == 'C') {return 12;}else if (ch == 'D') {return 13;}else if (ch == 'E') {return 14;}else if (ch == 'F') {return 15;}else if (ch <= '9' && ch >= '0')return ch - '0';elsethrow new HexFormatException("Illegal hex character: " + ch); }}class HexFormatException extends Exception { HexFormatException() {super("Illegal hex character");}HexFormatException(String message) {super(message);}}public class Exercise13_10 {public static void main(String[] args) {try {int[] list = new int[20000000];}catch (Error ex) {ex.printStackTrace();System.out.println("You are running out of memory.");}System.out.println("GO");javax.swing.JOptionPane.showMessageDialog(null, "Wait"); }}。
C语言程序设计习题集--Final-answer

C语言程序设计习题集--Final-answer第1~2章C语言概述、算法、数据类型、运算符与表达式一、选择题ACDCB CCDCB D二、填空题1、n=202、a=66,b=E第3章顺序程序设计3.1顺序结构一、选择题BAAD二、程序阅读1、12 240 122、2,3,2,23、0三、编程1#include <stdio.h>#include <math.h>void main(){f loat a,b,c,s,area;s canf("%f,%f,%f",&a,&b,&c);s=(a+b+c)/2.0;a rea=sqrt(s*(s-a)*(s-b)*(s-c));p rintf("a=%f,b=%f,c=%f,area=%f",a,b,c, area);}2#include <stdio.h>#include <math.h>void main(){f loat a,b,c,del,x1,x2;s canf("%f,%f,%f",&a,&b,&c);d el=b*b-4*a*c;i f (del>=0){x1=(-b+sqrt(del))/(2*a);x2=(-b-sqrt(del))/(2*a);printf("x1=%f,x2=%f",x1,x2);}e lseprintf("没有实根");}3#include <stdio.h>void main(){i nt c,f;c=26;f=9.0/5.0*c+32;p rintf("%d的华氏温度是%d",c,f);}3.2选择结构一、选择题DBBCDC二、程序阅读1、|a|+|b|=612、PQ3、-14、60~6960error!5、0,16、a+b+c=15三、编程1#include <stdio.h>void main(){i nt a,b,c,min;s canf("%d,%d,%d",&a,&b,&c);m in=a;i f (min>b) min=b;i f (min>c) min=c;}2#include <stdio.h>void main(){i nt a;s canf("%d",&a);i f(a%3==0 && a%5==0 && a%7==0)printf("yes");e lseprintf("no");}3#include <stdio.h>#include <math.h>void main(){f loat x,y;s canf("%f",&x);i f (x<0)y=fabs(x);e lse if(x>=0 && x<=2)y=sqrt(x+1);e lse if (x>=2 && x<4)y=pow(x+2,3);e lsey=2*x+5;p rintf("x=%f,y=%f",x,y);}4#include <stdio.h>void main(){float rate,tax,salary;scanf("%f",salary);if(salary<=850)rate=0;else if(salary>1350 && salary<=2850) rate=0.1;else if(salary>2850 && salary<5850)rate=0.15;elserate=0.2;tax=rate*(salary-850);printf("salary=%f,rate=%f,tax=%f",salary,rate,tax);}3.3循环结构一、填空题:1、222、233、464、117二、选择题:1.C2.D3.B4.B5.B6.C7.C8.C9.B 10.D三、程序阅读:1、输出:332、输出:243、2#4#7#11#16#4、3#2#0#0#1#5、B,A,D,C6、D,A,B,C7、B,C,A,D8、A,D,D,C9、C,C,A10、B,D,A11、A,D,C四、编程1.#include <stdio.h>#include <math.h>void main(){ int x;printf("x sqrt(x)\n");for(x=5;x<=1000;x++)printf("%d %f\n", x, sqrt(x));}2.#include<stdio.h>#include<math.h>main(){int i,flag;double pi,item;i=1;flag=1;pi=0;item=1.0;while(fabs(item)>=0.00001){ item=flag*1.0/i;pi=pi+item;flag=-flag;i=i+2;}pi=pi*4;printf("pi=%f",pi);}3.#include "math.h"main( ){ int j,m,k;printf("Enter an integer number: "); scanf("%d",&m);for (j=2; j<=m-1; j++)if (m%j==0) break;printf("%d ",m);if (j>=m)printf("YES\n");elseprintf("NO\n"); }4.#include<stdio.h>main(){ int i,num1,num2,num3;num1=1;num2=1;printf("%d %d ",num1,num2);for(i=3;i<=10;i=i+1){num3=num1+num2;printf("%d ",num3);num1=num2;num2=num3;}}第4章数组一、选择题:1. D2.D3.A4.C5.C6.C7.D8.B9.D 10.B 11.D 12.D 13.D 14.A 15.B二、程序阅读:1、A,B,B,D2、C,D,A,B3、B,B4、D,C,A5、C,D6、C,A7、1#2#3#1#1#38、298三、编程:1、#include <stdio.h>void main( ){int mark, a, p, f;a = p = f = 0;printf("Enter scores:");scanf ("%d", &mark);while (mark >0){if(mark >= 85) a++;else if (mark >= 60) p++;else f++;scanf ("%d", &mark);}printf(">=85:%d\n", a);printf("60-84:%d\n", p);printf("<60:%d\n", f);}2、#include <stdio.h>void main( ){ int a[10],count=0,i;float average,sum=0;for(i=0;i<10;i++){ scanf("%d",&a[i]);sum=sum+a[i];}average=sum/10;for(i=0;i<10;i++)if(a[i]>average) count=count+1;printf("平均值为%f 大于平均值的数有%d个",average,count);}3.#include<stdio.h>main( ){ int a[10];int i,j,t,n;printf(“请输入一个正整数n(1<n≤10):”); scanf(“%d”,&n);printf(“请输入数据:”);for (i=0; i<n; i++)scanf("%d",&a[i]);printf("\n");for (j=0; j<n-1; j++) /*确定基准位置*/ for(i=j+1; i<n; i++)if (a[j]>a[i]){ t=a[j];a[j]=a[i];a[i]=t; }printf("The sorted numbers: \n");for (i=0; i<n; i++)printf("%d",a[i]);}4.#include <stdio.h>void main(){int a[6][6],n,i,j,x,y,max;printf(“请输入一个正整数n(1≤n≤6):”); scanf(“%d”,&n);printf(“请输入一个n行n列的矩阵:\n”); for (i=0;i<n;i++)for (j=0;j<n;j++)scanf(“%d”,&a[i][j]);max=a[0][0]; x=0;y=0;for (i=0;i<n;i++)for (j=0;j<n;j++)if (fabs(a[i][j])>max) {max=a[i][j];x=i;y=j;}printf(“绝对值最大的元素为:%d,下标分别为:%d,%d\n”,max,x,y);}第5章函数一、选择题(1) A(2) B(3) C(4) B(5) D(6) C(7)i. Bii. Diii. Aiv. C(8)i. Dii. Ciii. Biv. A(9)i. Dii. Biii. B(10)i. Cii. Ciii. Biv. B二、程序阅读题(1)3,5(2) 4(3)s=10(4)5,25三、程序设计1# include<stdio.h> # include<math.h>int isprime(int m){ int k, n, res;if(m == 1) return 0;res = 1;n = (int)sqrt(m);for(k = 2; k <= n; k++)if(m%k == 0){res=0;break;}return res;}void main( ){int m,n;int sum=0;int i;do{printf("Input m,n m<n like:3,10\n");scanf("%d,%d",&m,&n);}while(m<0 || n<0 || m>n);for(i=m;i<=n;i++){if(isprime(i)){sum+=i;}}printf("The all primes' sum is:%d\n",sum);}2int max_value(int arr[][4]){int i,j,max;max=arr[0][0];for(i=0;i<2;i++)for(j=0;j<4;j++){if(max<a[i][j])max=a[i][j];}return max;}3# include<stdio.h># include<math.h>int isTheFineNumber(int n) {int a,b,c,x=0,i;for(i=101;i<n;i++)if((int)sqrt(n)==sqrt(n)) { a=n%10;b=(n/10)%10;c=n/100;if(a==b||b==c||c==a)x=x+1;}return x;}void main(){ int n;scanf("%d",&n);printf("%d\n", isTheFineNumber(n)); }第7章预处理命令CBBBD DDBC第8章指针一、选择题:1、 D2、 A3、 D4、 A5、 D6、 B7、 C8、 D9、 B10、D11、D二、程序阅读题:1、 C2、 A3、 B4、 C5、 A三、程序设计题:1#include<stdio.h>void main(){ void swap(int *pointer1,int *pointer2); int *p1,*p2;int a=1,b=2;p1=&a;p2=&b;swap(p1,p2);printf("%d\n%d",a,b);}void swap(int *p1,int *p2){int temp;temp=*p1;*p1=*p2;*p2=temp;}2#include<stdio.h>void main(){ int a[10],*p1,i,j,temp;p1=a;for(i=0;i<10;i++)scanf("%d",p1+i);for(i=0;i<10;i++){p1=a;for(j=0;j<10-i;j++,p1++)if(*p1>*(p1+1)){temp=*p1;*p1=*(p1+1);*(p1+1)=temp;}}p1=a;for(i=0;i<10;i++,p1++)printf("%d ",*p1);}3#include<stdio.h>void main(){intupper=0,lower=0,digit=0,space=0,other=0,i=0; char *p,s[20];printf("input string:");while((s[i]=getchar())!='\n') i++;p=&s[0];while(*p!='\n'){if(('A'<=*p)&&(*p<='Z'))++upper;else if (('a'<=*p)&&(*p<='z'))++lower;else if (*p==' ')++space;else if (('0'<=*p)&&(*p<='9'))++digit;else ++other;p++;}printf("upper case is:%d lower case:%d",upper,lower);printf("space: %d digit:%d other:%d",space,digit,other);}4strmcpy(char s[],char t[],int m){ char *p1,*p2,i;p1=s;p2=t+m;while(*p2!='\0'){*p1=*p2;p1++;p2++;}}5#include<stdio.h>void main(){ints[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};int *p,i,j,t;p=&s[0][0];for(i=0;i<4;i++)for(j=i;j<4;j++){t=*(p+4*i+j);*(p+4*i+j)=*(p+4*j+i);*(p+4*j+i)=t;}}第9章结构体共用体一、选择题:1.D、D、D、D、C2.D3.A4.BC (选项B改为(*p).pk,结果为C)5.D二、选择填空题:1.B2.C三、编程题:1#include<stdio.h>struct{int year;int month;int day;}date;void main(){ int days;printf("input year,month,day:\n");scanf("%d%d%d",&date.year,&date.month,&date.day);switch (date.month){case 1:days=date.day;break;case 2:days=date.day+31;break;case 3:days=date.day+59;break;case 4:days=date.day+90;break;case 5:days=date.day+120;break;case 6:days=date.day+151;break;case 7:days=date.day+181;break;case 8:days=date.day+212;break;case 9:days=date.day+243;break;case 10:days=date.day+273;break;case 11:days=date.day+304;break;case 12:days=date.day+334;break;}if((date.year%4==0&&date.year%100!=0||date. year%400==0)&&date.month>=3)days+=1;printf("%d/%d is the %dth day in %d\n",date.month,date.day,days,date.year);}2#include<stdio.h>struct{int hour;int min;int sec;}time1,time2,time3;void main(){printf("input the first time hour,min,sec:\n");scanf("%d%d%d",&time1.hour,&time1.min,& time1.sec);printf("input the second time hour,min,sec:\n");scanf("%d%d%d",&time2.hour,&time2.min,& time2.sec);time3.sec=time2.sec-time1.sec;if(time3.sec<0){time3.sec+=60;time2.sec--;}time3.min=time2.min-time1.min;if(time3.min<0){time3.min+=60;time2.min--;}time3.hour=time2.hour-time1.hour;printf("timelag is hour:%d min:%d sec:%d ",time3.hour,time3.min,time3.sec);}3#include<stdio.h>#define N 5struct student{char num[6];char name[6];int score[4];}stu[N];void main(){ void print(struct student stu[6]);int i,j;for(i=0;i<N;i++){printf("ninput score of student %d:\n",i+1);printf("No.: ");scanf("%s",stu[i].num);printf("name: ");scanf("%s",stu[i].name);for(j=0;j<3;j++){printf("score %d: ",j+1);scanf("%d",&stu[i].score[j]);}printf("\n");print(stu);}}void print(struct student stu[6]){int i,j;printf("\n No. name score1score2 score3\n");for(i=0;i<N;i++){printf("%5s%10s",stu[i].num,stu[i].name); for(j=0;j<3;j++)printf("%9d",stu[i].score[j]);printf("\n");}}第10章文件一、选择题C C B B A C CD D C D D D二、编程1.#include <stdio.h>#include <string.h>void main(){FILE *fp;char str[80];if((fp=fopen("test.txt","r"))==NULL)printf("error\n");while(!feof(fp)){fscanf(fp,"%s\n",str);if(strstr(str,"for")!=NULL)printf("%s\n",str);}fclose(fp);}2.#include <stdio.h>#include <string.h>void main(){FILE *fp;int n,sum=0;if((fp=fopen("in.txt","a+"))==NULL)printf("error\n");while(!feof(fp)){fscanf(fp,"%d\n",&n);sum+=n;}fprintf(fp,"\nsum=%d\n",sum); fclose(fp);}3.#include <stdlib.h>#include <stdio.h>void main(int argc,char *argv[ ]){FILE *in,*out;char ch;if (argc!=3){printf("You forgot to enter a filename\n");exit(0);}if((in=fopen(argv[1],"r"))==NULL){printf("cannot open infile\n");exit(0);}if((out=fopen(argv[2],"w"))==NULL){printf("cannot open outfile\n");exit(0);}while(!feof(in)) fputc(fgetc(in),out);fclose(in);fclose(out);}4.#include <stdio.h>#include <string.h>void main(){FILE *fp;int n,a=0,b=0,c=0;if((fp=fopen("number.dat","a+"))==NULL)printf("error\n");while(!feof(fp)){fscanf(fp,"%d\n",&n);if(n>0)a++;else if(n<0)b++;else c++;}printf("正数有%d个,负数有%d个,零有%d 个\n",a,b,c);fclose(fp);}。
java语言程序设计基础篇第十版第十三章练习答案

01public class Exercise13_01 { public static void main(String[] args) { TriangleNew triangle = new TriangleNew(1, , 1);("yellow");(true);"The area is " + ());"The perimeter is "+ ());}}class TriangleNew extends GeometricObject { private double side1 = , side2 = , side3 = ;/** Constructor */public TriangleNew() {}/** Constructor */public TriangleNew(double side1, double side2, double side3) { = side1;= side2;= side3;}/** Implement the abstract method findArea in GeometricObject */ public double getArea() {double s = (side1 + side2 + side3) / 2;return (s * (s - side1) * (s - side2) * (s - side3));}/** Implement the abstract method findCircumference in* GeometricObject**/public double getPerimeter() { return side1 + side2 + side3;}@Overridepublic String toString() {]Number currentMin = (i);int currentMinIndex = i;for (int j = i + 1; j < (); j++) { if () > (j).doubleValue()) { currentMin = (j); currentMinIndex = j;}}public class Exercise13_04 {static MyCalendar calendar = new MyCalendar();public static void main(String[] args) {int month = + 1;int year = ;if > 2)"Usage java Exercise13_04 month year");else if == 2) {etRadius())return 1;else if (getRadius() < ((Circle1) o).getRadius()) return -1;elsereturn 0;}}06public class Exercise13_06 {etArea());if (objects[i] instanceof Colorable)((Colorable)objects[i]).howToColor();}}}interface Colorable {void howToColor();}class Square extends GeometricObject implements Colorable {private double side;public Square(double side) { = side;}@Overridepublic void howToColor() {"Color all four sides");}@Overridepublic double getArea() { return side * side;}@Overridepublic double getPerimeter() { return 4 * side;}}08import class Exercise13_08 {public static void main(String[] args) {MyStack1 stack = new MyStack1();("S1");("S2");("S");MyStack1 stack2 = (MyStack1) ()); ("S1");("S2");("S");class MyStack1 implements Cloneable {private ArrayList<Object> list = new ArrayList<Object>();public boolean isEmpty() {return ();public int getSize() {return ();}public Object peek() {return (getSize() - 1);}public Object pop() {Object o = (getSize() - 1);(getSize() - 1);return o;}public void push(Object o) {(o);}/** Override the toString in the Object class */ public String toString() {return "stack: " + ();}public Object clone() {try {MyStack1 c = (MyStack1) ();= (ArrayList<Object>) return c;} catch (CloneNotSupportedException ex) { return null;}}}09public class Exercise13_09 {public static void main(String[] args) {Circle13_09 obj1 = new Circle13_09();Circle13_09 obj2 = new Circle13_09();}}adius;}}10public class Exercise13_10 {public static void main(String[] args) {Rectangle13_10 obj1 = new Rectangle13_10();Rectangle13_10 obj2 = new Rectangle13_10();}}etArea();}}11public class Exercise13_11 {public static void main(String[] args) {Octagon a1 = new Octagon(5);"Area is " + ());"Perimeter is " + ());Octagon a2 = (Octagon)());"Compare the methods " + (a2));}}class Octagon extends GeometricObject implements Comparable<Octagon>, Cloneable { private double side;/** Construct a Octagon with the default side */ public Octagon () { etArea();return sum;}}etNumerator() == 0)return true;elsereturn false;/**Override the intValue method*/ public int intValue() {/**@todo: implement this abstract method*/return (int)doubleValue();}/**Override the floatValue method*/ public float floatValue() {/**@todo: implement this abstract method*/return (float)doubleValue();}/**Override the doubleValue method*/ public double doubleValue() { /**@todo: implement this abstract method*/return r[0]*r[1];}/**Override the longValue method*/ public long longValue() {/**@todo: implement this abstract method*/return (long)doubleValue();}@Overridepublic int compareTo(NewRational o) {/**@todo: Implement this method*/if (((NewRational)o)).getNumerator() > 0) return 1;else if (((NewRational)o)).getNumerator() < 0) return -1;elsereturn 0;}}15import .*;public class Exercise13_15 {public static void main(String[] args) {Rational r1 = new Rational(new BigInteger("4"), new BigInteger("2"));Rational r2 = new Rational(new BigInteger("2"), new BigInteger("3"));ivide(gcd);else= (gcd);= ().divide(gcd);}/** Find GCD of two numbers */private static BigInteger gcd(BigInteger n, BigInteger d) { BigInteger n1 = ();BigInteger n2 = ();BigInteger gcd = ;for (BigInteger k = ;(n1) <= 0 && (n2) <= 0;k = ) {if (k).equals &&(k).equals)gcd = k;}return gcd;}/** Return numerator */public BigInteger getNumerator() {return numerator;}/** Return denominator */public BigInteger getDenominator() {return denominator;}/** Add a rational number to this rational */public Rational add(Rational secondRational) {BigInteger n = ()).add(()));BigInteger d = ());return new Rational(n, d);/** Subtract a rational number from this rational */public Rational subtract(Rational secondRational) {BigInteger n = ()).subtract(()));BigInteger d = ()); return new Rational(n, d);}/** Multiply a rational number to this rational */ public Rational multiply(Rational secondRational) {BigInteger n = ());BigInteger d = ()); return new Rational(n, d);}/** Divide a rational number from this rational */ public Rationaldivide(Rational secondRational) {BigInteger n = ());BigInteger d = ; return new Rational(n, d);}@Override public String toString() {if )return numerator + "";elsereturn numerator + "/" + denominator;}@Override /** Override the equals method in the Object class */ public boolean equals(Object parm1) {if (((Rational)(parm1))).getNumerator().equals)return true;elsereturn false;}@Override /** Override the hashCode method in the Object class */ public int hashCode() {return new Double()).hashCode();}@Override /** Override the abstract intValue method in */ public int intValue() {return (int)doubleValue();}@Override /** Override the abstract floatValue method in */ public float floatValue() { return (float)doubleValue();}@Override /** Override the doubleValue method in */public double doubleValue() {return () / ();}@Override /** Override the abstract longValue method in */ public long longValue() { return (long)doubleValue();}@Overridepublic int compareTo(Rational o) {if (((Rational)o)).getNumerator()pareTo > 0) return 1;else if (((Rational)o)).getNumerator()pareTo < 0) return -1;elsereturn 0;}}}16public class Exercise13_16 {public static void main(String[] args) {Rational result = new Rational(0, 1);if != 1) {"Usage: java Exercise13_16 \"operand1 operator operand2\""); (1);}String[] tokens = args[0].split(" ");switch (tokens[1].charAt(0)) {case '+': result = getRational(tokens[0]).add(getRational(tokens[2]));break;case '-': result = getRational(tokens[0]).subtract(getRational(tokens[2]));break;case '*': result = getRational(tokens[0]).multiply(getRational(tokens[2]));break;case '/': result = getRational(tokens[0]).divide(getRational(tokens[2]));}+ " " + tokens[1] + " " + tokens[2] + " = " + result);}static Rational getRational(String s) {String[] st = ("/");int numer = (st[0]);int denom = (st[1]);return new Rational(numer, denom);}}/* Alternatively, you can use StringTokenizer. See Supplement on StringTokenizer as alternativeimport class Exercise15_18 {public static void main(String[] args) {Rational result = new Rational(0, 1);if != 3) {"Usage: java Exercise15_22 operand1 operator operand2");(0);}switch (tokens[1].charAt(0)) {case '+': result = getRational(tokens[0]).add(getRational(tokens[2])); break;case '-': result = getRational(tokens[0]).subtract(getRational(tokens[2]));break;case '*': result = getRational(tokens[0]).multiply(getRational(tokens[2]));break;case '/': result = getRational(tokens[0]).divide(getRational(tokens[2]));}+ " " + tokens[1] + " " + tokens[2] + " = " + result);}static Rational getRational(String s) {"(" + c1"(" + c1 "(" + c1 "(" + c1"|" + c1 + "| = " + ());StringTokenizer st = new StringTokenizer(s, "/"); int numer = newInteger()).intValue(); int denom = new Integer()).intValue(); return newRational(numer, denom);}}*/ 17import class Exercise13_17 {public static void main(String[] args) { Scanner input = new Scanner; "Enter the first complex number: "); double a = (); double b = ();Complex c1 = new Complex(a, b);"Enter the second complex number: "); double c = ();double d = ();Complex c2 = new Complex(c, d);+ ")" + " + " + "(" + c2 + ")" + " = " + (c2)); + ")" + " - " + "(" + c2 + ")" + " = " + (c2)); + ")" + " * " + "(" + c2 + ")" + " = " + (c2)); + ")" + " / " + "(" + c2 + ")" + " = " + (c2)); Complex c3 = (Complex)();== c3);}}class Complex implements Cloneable { private double a = 0, b = 0;public Complex() { }Complex(double a, double b) { = a;= b;public Complex(double a) {= a;}public double getA() {return a;}public double getB() {return b;}public Complex add(Complex secondComplex) { double newA = a + ();double newB = b + ();return new Complex(newA, newB);}public Complex subtract(Complex secondComplex) { double newA = a - (); double newB = b - ();return new Complex(newA, newB);}public Complex multiply(Complex secondComplex) { double newA = a * () - b * (); double newB = b * () + a * ();return new Complex(newA, newB);}public Complex divide(Complex secondComplex) { double newA = (a * () + b * ()) / (), + (),);double newB = (b * () - a * ())/ (), + (),);return new Complex(newA, newB);}public double abs() {return (a * a + b * b);+ items[1]), @Override public String toString() {if (b != 0)return a + " + " + b + "i";return a + "";}public double getRealPart() {return a;}public double getImaginaryPart() {return b;}@Override /** Implement the clone method inthe Object class */public Object clone() {");if == 1) {return new Rational(new BigInteger(items[0]), ;}else {Rational r = new Rational(new BigInteger(items[0]getDenominator(items[1].length()));return r;}}private static BigInteger getDenominator(int size) {BigInteger result = ;for (int i = 0; i < size; i++)result = (new BigInteger("10"));return result;}static class Rational extends Number implements Comparable<Rational>{ ivide(gcd);else = (gcd);= ().divide(gcd);/** Find GCD of two numbers */private static BigInteger gcd(BigInteger n, BigInteger d) { BigInteger n1 = (); BigInteger n2 = ();BigInteger gcd = ;for (BigInteger k = ;(n1) <= 0 && (n2) <= 0;k = ) {if (k).equals &&(k).equals)gcd = k;}return gcd;}/** Return numerator */public BigInteger getNumerator() {return numerator;}/** Return denominator */public BigInteger getDenominator() {return denominator;}/** Add a rational number to this rational */public Rational add(Rational secondRational) {BigInteger n = ()).add(()));BigInteger d = ());return new Rational(n, d);}/** Subtract a rational number from this rational */ public Rational subtract(Rational secondRational) {BigInteger n = ()).subtract(()));BigInteger d = ());return new Rational(n, d);/** Multiply a rational number to this rational */public Rational multiply(Rational secondRational) {BigInteger n = ());BigInteger d = ());return new Rational(n, d);}/** Divide a rational number from this rational */public Rational divide(Rational secondRational) {BigInteger n = ());BigInteger d = ;return new Rational(n, d);}@Overridepublic String toString() {if )return numerator + "";elsereturn numerator + "/" + denominator;}@Override /** Override the equals method in the Object class */ public boolean equals(Object parm1) {if (((Rational)(parm1))).getNumerator().equals)return true;elsereturn false;}@Override /** Override the hashCode method in the Object class */ public int hashCode() {return new Double()).hashCode();}@Override /** Override the abstract intValue method in */ public int intValue() { return (int)doubleValue();}@Override /** Override the abstract floatValue method in */ public float floatValue() { return (float)doubleValue();@Override /** Override the doubleValue method in */public double doubleValue() {return () / ();}@Override /** Override the abstract longValue method in */ public long longValue() { return (long)doubleValue();}@Overridepublic int compareTo(Rational o) {if (((Rational)o)).getNumerator()pareTo > 0)return 1;else if (((Rational)o)).getNumerator()pareTo < 0)return -1;elsereturn 0;}}}20import class Exercise13_20 {public static void main(String[] args) {Scanner input = new Scanner;"Enter a, b, c: ");double a = ();double b = ();double c = ();double discriminant = b * b - 4 * a * c;if (discriminant < 0) {Complex r1 = new Complex(-b / (2 * a), (-discriminant, / (2 * a));Complex r2 = new Complex(-b / (2 * a), (-discriminant, / (2 * a)); "The roots are " + r1 + " and " + r2);}else if (discriminant == 0) {double r1 = -b / (2 * a);"The root is " + r1);}else { // (discriminant > 0)double r1 = (-b + (discriminant, ) / (2 * a); double r2 = (-b - (discriminant, ) / (2 * a);"The roots are " + r1 + " and " + r2);}}}21 import class Exercise13_21 { public static void main(String[] args) { Scanner input = new Scanner;"Enter a, b, c: "); int a = ();int b = (); int c = ();Rational h = new Rational(-b, 2 * a);Rational k = new Rational(4 * a * c - b * b, 4 * a);"h is " + h + " " + "k is " + k); }。
金融英语第十三章答案

金融英语第十三章答案Chapter13 (exercises)I .Answer the following questions in English.1.Carefully describe a futures contract.A future contract is a blinding agreement between a seller and a buyer to make and to take delivery of the underlying commodity at a specified future date with agreed upon payment terms.Futures contracts are standardized with respect to the delivery month.2.Explain how futures contracts are valued daily,It is possible to calculate a theoretical fair value for a futures contract.The fair value of a futures contract should approximately equal the current value of the underlying shares or index,plus an amount referred to as the “cost of carry”.The full value of the contract is not paid or received when the contract is established-instead both buyer and seller pay a small initialmargin.3.Describe the role of the clearinghouse in futures trading.The clearinghouse,an agency or separate corporation of a futures exchange.The clearinghouse becomes the buyer to each seller and assumes responsibility for protecting buyers and sellers from financial loss by assuring performance on each contract.4. Explain the differences between a hedger and a speculator.The difference between hedgers an speculators is the risk.Hedgers are parties at risk with a commodity or an asset,but speculators trads futures with the objective of making a profit by being on the right side of a price move.5. Give a brief description of the history of futures.Both the histories of futures are focused on that how people have tried to improve the effectiveness of the commercial marketplace. 6. What is key difference between forward and futures?Forward contracts and futures comparison: the former is a standardized contract, OTC, flexible and high transaction cost, risk is big. The latter are standardized contracts, exchange as a medium, investors and unlike forward contracts as the direct trading, risk is small.Options and futures comparison: futures trading both sides has rights and obligations. While the option buyer the right to sell only, only obligation. In addition from the gains and losses, the futures of profit and loss is uncertain, but the option buyer 's loss is the option premium.Ⅱ. Fill in the e ach blank with an appropriate word or expression.1. Futures are binding agreements made between two partiesthrough a regulated futures exchange. Each futures contract specifies the quantity and quality of the item, expirationmonth, the time of delivery and virtually all the detailsof the transaction except price , which the two partiesnegotiate based on current market conditions.2. The clearinghouse, an agency or separate corporation of afutures exchange, is responsible for settlingtrading accounts, collecting and margin monies,regulating delivery and reporting trade data.3. A futures contract is an agreement to purchase or sell acommodity for delivery in the future: ( 1 ) at a price thatis determined at initiation of the contract; (2) whichobligates each party to the contract to the contract at thespecified price; (3) which is used to assume or shift pricerisk ; and(4) which may be satisfied by delivery or offset4. The key to any hedge is that a futures position is taken opposite to the position in the cash market. That is, the nature of cash market position determines the hedge in the futures market.5. Currency futures are standardized contracts that tradelike conventional commodity futures on the floor of a futures exchange.6. These orders,from companies,individuals,and evenmarket-making commercial banks, are happened to the floor ofthe futures exchange.Ⅲ. Translate the following sentences into English.1.商品生产者和经营者在生产和经营过程中,时刻面临着价格波动的风险。
参考答案-final

1、 写一个MATLAB 小程序,求出最大的n 值,使得n!<realmax >> s=1;n=0;>>while (s<realmax) n=n+1; s=s*n; end >> n-1 n = 1702、 写一个MATLAB 函数myfun.m 来计算下列方程式:y=0.5*exp(x/3)-x*x*sin(x)其中x 是函数的输入,y 是函数的输出。
你的函数必须能处理当x 是标量或向量的两种情况。
>> syms x;>> myfun=@(x,y)0.5.*exp(x./3)-x.*x.*sin(x); >> y=myfun(x);3、 一个平面上的椭圆可以表示成下列方程式:1)/()/(22=+b y a x 。
我们也可以用参数将椭圆表示成:x=a*cos(θ) y=b*sin(θ)。
请利用上述参数式,画出一个椭圆,其中a=5,b=3,而且椭圆上共有100个点。
>> theta = [0 : 2*pi/100 : 2*pi]; >> a=3; >> b=5;>> x=a.*cos(theta); >> y=b.*sin(theta); >> plot(x,y, '.')4、 一条参数式的曲线可由下列方程式表示:x=sin(-t)+t y=1-cos(-t)当t 由0变化到4*pi 时,画出此曲线在XY 平面的轨迹。
>> t=[0:4*pi/200:4*pi]; >> x=sin(-t)+t; >> y=1-cos(-t); >> plot(x,y,’.’)5、 请用meshc 命令来同时画出下列函数的曲面图和等高线图:z=xy/(x+y)。
其中x 和y 都介于0和1之间,且各自都分成21个栅格点,所以此曲面共有441个点。
数据库13章习题参考答案

2、在实体中有属性可作为键而选定其中一个时,称
为该实体的 ( C )。 A.外部键 B.候选键 C.主键 D.主属性
3、若某属性虽非该实体的主键,却是另一实体的主
键,称该属性为( A )。 A.外部键 B.候选键 C.主键 D.主属性
2、4 查询优化
第二章 习题
3>、检索在“联华公司”工作的工号和姓名。 4>、假设每一个职工可以在多个公司工作,检索在 A1和A4公司兼职职工的工号和姓名。 5>、检索在“联华公司”工作,工资在6000元以上 的女职工的工号和姓名。
2、将上题中的“5、”用优化的查询表达式表示,并 画出语法树。
第二章 习题参考答案: 一、单项选择题
第二章 习题
二、多项选择题
1、按照表达查询的方式不同,关系DML可分( ) A. 关系代数 B. 关系演算 C.元组演算 D.域 演算 2、相容关系满足的条件是( ) 。 A. 属性名相同 B. 关系度数相同 C.相应属性取自同一个域 D.关系元组个数相同 3.关系代数中专门的关系运算包括除法和( ) A. 投影 B. 选择 C.插入 D.联接 4、把关系看成二维表,下列说法正确的是( ) A. 表中允许出现相同的行 B.表中不允许出现相同 的列 C.行的次序可以交换 D.列的次序可以交换
第一章 习题解答
一、填空题 1、DBS,DBMS和DB的关系是——。 DBS包含DBMS和DB 2、 3个模式之间存在的两种映射关系 是——。外模式/模式、模式/内模式 3、在数据库技术发展过程中,文件系统 与数据库系统的重要区别是——。 数据库系统具有特定的数据模型 4、数据是信息的载体,信息是数据的— —。内涵
java语言程序设计基础篇第十版第十三章练习答案

01public class Exercise13_01 {public static void main(String[] args) {TriangleNew triangle = new TriangleNew(1, 1.5, 1);triangle.setColor("yellow");triangle.setFilled(true);System.out.println(triangle);System.out.println("The area is " + triangle.getArea());System.out.println("The perimeter is "+ triangle.getPerimeter());System.out.println(triangle);}}class TriangleNew extends GeometricObject {private double side1 = 1.0, side2 = 1.0, side3 = 1.0;/** Constructor */public TriangleNew() {}/** Constructor */public TriangleNew(double side1, double side2, double side3) {this.side1 = side1;this.side2 = side2;this.side3 = side3;}/** Implement the abstract method findArea in GeometricObject */ public double getArea() {double s = (side1 + side2 + side3) / 2;return Math.sqrt(s * (s - side1) * (s - side2) * (s - side3));}/** Implement the abstract method findCircumference in* GeometricObject**/public double getPerimeter() {return side1 + side2 + side3;}@Overridepublic String toString() {// Implement it to return the three sidesreturn "TriangleNew: side1 = " + side1 + " side2 = " + side2 +" side3 = " + side3;}}02import java.util.ArrayList;public class Exercise13_02 {public static void main(String[] args) {ArrayList<Number> list = new ArrayList<Number>();list.add(14);list.add(24);list.add(4);list.add(42);list.add(5);shuffle(list);for (int i = 0; i < list.size(); i++)System.out.print(list.get(i) + " ");}public static void shuffle(ArrayList<Number> list) {for (int i = 0; i < list.size() - 1; i++) {int index = (int)(Math.random() * list.size());Number temp = list.get(i);list.set(i, list.get(index));list.set(index, temp);}}}03import java.util.ArrayList;public class Exercise13_03 {public static void main(String[] args) {ArrayList<Number> list = new ArrayList<Number>();list.add(14);list.add(24);list.add(4);list.add(42);list.add(5);sort(list);for (int i = 0; i < list.size(); i++)System.out.print(list.get(i) + " ");}public static void sort(ArrayList<Number> list) {for (int i = 0; i < list.size() - 1; i++) {// Find the minimum in the list[i..list.length-1]Number currentMin = list.get(i);int currentMinIndex = i;for (int j = i + 1; j < list.size(); j++) {if (currentMin.doubleValue() > list.get(j).doubleValue()) {currentMin = list.get(j);currentMinIndex = j;}}// Swap list.get(i) with list.get(currentMinIndex) if necessary;if (currentMinIndex != i) {list.set(currentMinIndex, list.get(i));list.set(i, currentMin);}}}}04import java.util.*;public class Exercise13_04 {static MyCalendar calendar = new MyCalendar();public static void main(String[] args) {int month = calendar.get(MyCalendar.MONTH) + 1;int year = calendar.get(MyCalendar.YEAR);if (args.length > 2)System.out.println("Usage java Exercise13_04 month year");else if (args.length == 2) {//use user-defined month and yearyear = Integer.parseInt(args[1]);month = Integer.parseInt(args[0]);calendar.set(Calendar.YEAR, year);calendar.set(Calendar.MONTH, month - 1);}else if (args.length == 1) {//use user-defined month for the current yearmonth = Integer.parseInt(args[0]);calendar.set(Calendar.MONTH, month-1);}//set date to the first day in a monthcalendar.set(Calendar.DATE, 1);//print calendar for the monthprintMonth(year, month);}static void printMonth(int year, int month) {//get start day of the week for the first date in the monthint startDay = getStartDay();//get number of days in the monthint numOfDaysInMonth = calendar.daysInMonth();//print headingsprintMonthTitle(year, month);//print bodyprintMonthBody(startDay, numOfDaysInMonth);}static int getStartDay() {return calendar.get(Calendar.DAY_OF_WEEK);}static void printMonthBody(int startDay, int numOfDaysInMonth) { //print padding space before the first day of the monthint i = 0;for (i = 0; i < startDay-1; i++)System.out.print(" ");for (i = 1; i <= numOfDaysInMonth; i++) {if (i < 10)System.out.print(" "+i);elseSystem.out.print(" "+i);if ((i + startDay - 1) % 7 == 0)System.out.println();}System.out.println("");}static void printMonthTitle(int year, int month) {System.out.println(" "+calendar.getMonthName()+", "+year);System.out.println("-----------------------------");System.out.println(" Sun Mon Tue Wed Thu Fri Sat");}}05public class Exercise13_05 {// Main methodpublic static void main(String[] args) {// Create two comparable circlesCircle1 circle1 = new Circle1(5);Circle1 circle2 = new Circle1(4);// Display the max circleCircle1 circle = (Circle1) GeometricObject1.max(circle1, circle2);System.out.println("The max circle's radius is " + circle.getRadius());System.out.println(circle);}}abstract class GeometricObject1 implements Comparable<GeometricObject1> { protected String color;protected double weight;// Default constructprotected GeometricObject1() {color = "white";weight = 1.0;}// Construct a geometric objectprotected GeometricObject1(String color, double weight) {this.color = color;this.weight = weight;// Getter method for colorpublic String getColor() {return color;}// Setter method for colorpublic void setColor(String color) {this.color = color;}// Getter method for weightpublic double getWeight() {return weight;}// Setter method for weightpublic void setWeight(double weight) {this.weight = weight;}// Abstract methodpublic abstract double getArea();// Abstract methodpublic abstract double getPerimeter();public int compareTo(GeometricObject1 o) {if (getArea() < o.getArea())return -1;else if (getArea() == o.getArea())return 0;elsereturn 1;}public static GeometricObject1 max(GeometricObject1 o1, GeometricObject1 o2) { if (pareTo(o2) > 0)return o1;elsereturn o2;}}// Circle.java: The circle class that extends GeometricObjectclass Circle1 extends GeometricObject1 {protected double radius;// Default constructorpublic Circle1() {this(1.0, "white", 1.0);}// Construct circle with specified radiuspublic Circle1(double radius) {super("white", 1.0);this.radius = radius;}// Construct a circle with specified radius, weight, and colorpublic Circle1(double radius, String color, double weight) {super(color, weight);this.radius = radius;}// Getter method for radiuspublic double getRadius() {return radius;}// Setter method for radiuspublic void setRadius(double radius) {this.radius = radius;}// Implement the findArea method defined in GeometricObject public double getArea() {return radius * radius * Math.PI;}// Implement the findPerimeter method defined in GeometricObject public double getPerimeter() {return 2 * radius * Math.PI;}// Override the equals() method defined in the Object classpublic boolean equals(Circle1 circle) {return this.radius == circle.getRadius();}@Overridepublic String toString() {return "[Circle] radius = " + radius;}@Overridepublic int compareTo(GeometricObject1 o) {if (getRadius() > ((Circle1) o).getRadius())return 1;else if (getRadius() < ((Circle1) o).getRadius())return -1;elsereturn 0;}}06public class Exercise13_06 {// Main methodpublic static void main(String[] args) {// Create two comarable rectanglesComparableCircle circle1 = new ComparableCircle(5);ComparableCircle circle2 = new ComparableCircle(15);// Display the max rectComparableCircle circle3 = (ComparableCircle)Max.max(circle1, circle2);System.out.println("The max circle's radius is " + circle3.getRadius());System.out.println(circle3);}}class ComparableCircle extends Circle implements Comparable<ComparableCircle> { /** Construct a ComparableRectangle with specified properties */public ComparableCircle(double radius) {super(radius);}@Overridepublic int compareTo(ComparableCircle o) {if (getRadius() > o.getRadius())return 1;else if (getRadius() < o.getRadius())return -1;elsereturn 0;}}//Max.java: Find a maximum objectclass Max {/** Return the maximum of two objects */public static ComparableCircle max(ComparableCircle o1, ComparableCircle o2) {if (pareTo(o2) > 0)return o1;elsereturn o2;}}07public class Exercise13_07 {public static void main(String[] args) {GeometricObject[] objects = {new Square(2), new Circle(5), new Square(5), new Rectangle(3, 4), new Square(4.5)};for (int i = 0; i < objects.length; i++) {System.out.println("Area is " + objects[i].getArea());if (objects[i] instanceof Colorable)((Colorable)objects[i]).howToColor();}}}interface Colorable {void howToColor();}class Square extends GeometricObject implements Colorable {private double side;public Square(double side) {this.side = side;}@Overridepublic void howToColor() {System.out.println("Color all four sides");}@Overridepublic double getArea() {return side * side;}@Overridepublic double getPerimeter() {return 4 * side;}}08import java.util.ArrayList;public class Exercise13_08 {public static void main(String[] args) {MyStack1 stack = new MyStack1();stack.push("S1");stack.push("S2");stack.push("S");MyStack1 stack2 = (MyStack1) (stack.clone());stack2.push("S1");stack2.push("S2");stack2.push("S");System.out.println(stack.getSize());System.out.println(stack2.getSize());}}class MyStack1 implements Cloneable {private ArrayList<Object> list = new ArrayList<Object>();public boolean isEmpty() {return list.isEmpty();}public int getSize() {return list.size();}public Object peek() {return list.get(getSize() - 1);}public Object pop() {Object o = list.get(getSize() - 1);list.remove(getSize() - 1);return o;}public void push(Object o) {list.add(o);}/** Override the toString in the Object class */ public String toString() {return "stack: " + list.toString();}public Object clone() {try {MyStack1 c = (MyStack1) super.clone();c.list = (ArrayList<Object>) this.list.clone();return c;} catch (CloneNotSupportedException ex) {return null;}}}09public class Exercise13_09 {public static void main(String[] args) {Circle13_09 obj1 = new Circle13_09();Circle13_09 obj2 = new Circle13_09();System.out.println(obj1.equals(obj2));System.out.println(pareTo(obj2)); }}// Circle.java: The circle class that extends GeometricObjectclass Circle13_09 extends GeometricObject implements Comparable<Circle13_09> { private double radius;/** Return radius */public double getRadius() {return radius;}/** Set a new radius */public void setRadius(double radius) {this.radius = radius;}/** Implement the getArea method defined in GeometricObject */public double getArea() {return radius * radius * Math.PI;}/** Implement the getPerimeter method defined in GeometricObject*/public double getPerimeter() {return 2 * radius * Math.PI;}@Overridepublic String toString() {return "[Circle] radius = " + radius;}@Overridepublic int compareTo(Circle13_09 obj) {if (this.getArea() > obj.getArea())return 1;else if (this.getArea() < obj.getArea())return -1;elsereturn 0;}public boolean equals(Object obj) {return this.radius == ((Circle13_09)obj).radius;}}public class Exercise13_10 {public static void main(String[] args) {Rectangle13_10 obj1 = new Rectangle13_10();Rectangle13_10 obj2 = new Rectangle13_10();System.out.println(obj1.equals(obj2));System.out.println(pareTo(obj2));}}// Rectangle.java: The Rectangle class that extends GeometricObjectclass Rectangle13_10 extends GeometricObject implements Comparable<Rectangle13_10> { private double width;private double height;/** Default constructor */public Rectangle13_10() {this(1.0, 1.0);}/** Construct a rectangle with width and height */public Rectangle13_10(double width, double height) {this.width = width;this.height = height;}/** Return width */public double getWidth() {return width;}/** Set a new width */public void setWidth(double width) {this.width = width;}/** Return height */public double getHeight() {return height;}/** Set a new height */public void setHeight(double height) {this.height = height;/** Implement the getArea method in GeometricObject */public double getArea() {return width*height;}/** Implement the getPerimeter method in GeometricObject */ public double getPerimeter() {return 2*(width + height);}@Overridepublic String toString() {return "[Rectangle] width = " + width +" and height = " + height;}@Overridepublic int compareTo(Rectangle13_10 obj) {if (this.getArea() > obj.getArea())return 1;else if (this.getArea() < obj.getArea())return -1;elsereturn 0;}public boolean equals(Object obj) {return this.getArea() == ((Rectangle13_10)obj).getArea();}}11public class Exercise13_11 {public static void main(String[] args) {Octagon a1 = new Octagon(5);System.out.println("Area is " + a1.getArea());System.out.println("Perimeter is " + a1.getPerimeter());Octagon a2 = (Octagon)(a1.clone());System.out.println("Compare the methods " + pareTo(a2)); }}class Octagon extends GeometricObjectimplements Comparable<Octagon>, Cloneable {private double side;/** Construct a Octagon with the default side */public Octagon () {// Implement itthis.side = 1;}/** Construct a Octagon with the specified side */public Octagon (double side) {// Implement itthis.side = side;}@Override /** Implement the abstract method getArea in GeometricObject */public double getArea() {// Implement itreturn (2 + 4 / Math.sqrt(2)) * side * side;}@Override /** Implement the abstract method getPerimeter in GeometricObject */public double getPerimeter() {// Implement itreturn 8 * side;}@Overridepublic int compareTo(Octagon obj) {if (this.side > obj.side)return 1;else if (this.side == obj.side)return 0;elsereturn -1;}@Override /** Implement the clone method inthe Object class */public Object clone() {// Octagon o = new Octagon();// o.side = this.side;// return o;//// Implement ittry {return super.clone(); // Automatically perform a shallow copy }catch (CloneNotSupportedException ex) {return null;}}}12public class Exercise13_12 {public static void main(String[] args) {new Exercise13_12();}public Exercise13_12() {GeometricObject[] a = {new Circle(5), new Circle(6),new Rectangle13_12(2, 3), new Rectangle13_12(2, 3)};System.out.println("The total area is " + sumArea(a));}public static double sumArea(GeometricObject[] a) {double sum = 0;for (int i = 0; i < a.length; i++)sum += a[i].getArea();return sum;}}// Rectangle.java: The Rectangle class that extends GeometricObject class Rectangle13_12 extends GeometricObject {private double width;private double height;/** Construct a rectangle with width and height */public Rectangle13_12(double width, double height) {this.width = width;this.height = height;}/**Return width*/public double getWidth() {return width;}/**Set a new width*/public void setWidth(double width) {this.width = width;}/**Return height*/public double getHeight() {return height;}/**Set a new height*/public void setHeight(double height) {this.height = height;}/**Implement the getArea method in GeometricObject*/ public double getArea() {return width*height;}/**Implement the getPerimeter method in GeometricObject*/ public double getPerimeter() {return 2*(width + height);}/**Override the equals method defined in the Object class*/ public boolean equals(Rectangle rectangle) {return (width == rectangle.getWidth()) &&(height == rectangle.getHeight());}@Overridepublic String toString() {return "[Rectangle] width = " + width +" and height = " + height;}}13public class Exercise13_13 {/** Main method */public static void main(String[] args) {Course1 course1 = new Course1("DS");course1.addStudent("S1");course1.addStudent("S2");course1.addStudent("S3");Course1 course2 = (Course1) course1.clone();course2.addStudent("S4");course2.addStudent("S5");course2.addStudent("S6");System.out.println(course1.getNumberOfStudents());System.out.println(course2.getNumberOfStudents()); }}class Course1 implements Cloneable {private String courseName;private String[] students = new String[100];private int numberOfStudents;public Course1(String courseName) {this.courseName = courseName;}public void addStudent(String student) {students[numberOfStudents] = student;numberOfStudents++;}public String[] getStudents() {return students;}public int getNumberOfStudents() {return numberOfStudents;}public String getCourse1Name() {return courseName;}public void dropStudent(String student) {// Left as an exercise in Exercise 10.9}public Object clone() {try {Course1 c = (Course1) super.clone();c.students = new String[100];System.arraycopy(students, 0, c.students, 0, 100);c.numberOfStudents = numberOfStudents;return c;} catch (CloneNotSupportedException ex) {return null;}}}14class NewRational extends Number implements Comparable<NewRational> { // Data fields for numerator and denominatorprivate long[] r = new long[2];/**Default constructor*/public NewRational() {this(0, 1);}/**Construct a rational with specified numerator and denominator*/ public NewRational(long numerator, long denominator) {long gcd = gcd(numerator, denominator);this.r[0] = numerator/gcd;this.r[1] = denominator/gcd;}/**Find GCD of two numbers*/private long gcd(long n, long d) {long t1 = Math.abs(n);long t2 = Math.abs(d);long remainder = t1%t2;while (remainder != 0) {t1 = t2;t2 = remainder;remainder = t1%t2;}return t2;}/**Return numerator*/public long getNumerator() {return r[0];}/**Return denominator*/public long getDenominator() {return r[1];}/**Add a rational number to this rational*/public NewRational add(NewRational secondNewRational) { long n = r[0]*secondNewRational.getDenominator() +r[1]*secondNewRational.getNumerator();long d = r[1]*secondNewRational.getDenominator();return new NewRational(n, d);}/**Subtract a rational number from this rational*/public NewRational subtract(NewRational secondNewRational) { long n = r[0]*secondNewRational.getDenominator()- r[1]*secondNewRational.getNumerator();long d = r[1]*secondNewRational.getDenominator();return new NewRational(n, d);}/**Multiply a rational number to this rational*/public NewRational multiply(NewRational secondNewRational) { long n = r[0]*secondNewRational.getNumerator();long d = r[1]*secondNewRational.getDenominator();return new NewRational(n, d);}/**Divide a rational number from this rational*/public NewRational divide(NewRational secondNewRational) {long n = r[0]*secondNewRational.getDenominator();long d = r[1]*secondNewRational.r[0];return new NewRational(n, d);}@Overridepublic String toString() {if (r[1] == 1)return r[0] + "";elsereturn r[0] + "/" + r[1];}/**Override the equals method*/public boolean equals(Object parm1) {/**@todo: Override this ng.Object method*/if ((this.subtract((NewRational)(parm1))).getNumerator() == 0)return true;elsereturn false;}/**Override the intValue method*/public int intValue() {/**@todo: implement this ng.Number abstract method*/ return (int)doubleValue();}/**Override the floatValue method*/public float floatValue() {/**@todo: implement this ng.Number abstract method*/ return (float)doubleValue();}/**Override the doubleValue method*/public double doubleValue() {/**@todo: implement this ng.Number abstract method*/ return r[0]*1.0/r[1];}/**Override the longValue method*/public long longValue() {/**@todo: implement this ng.Number abstract method*/ return (long)doubleValue();}@Overridepublic int compareTo(NewRational o) {/**@todo: Implement this parable method*/if ((this.subtract((NewRational)o)).getNumerator() > 0)return 1;else if ((this.subtract((NewRational)o)).getNumerator() < 0)return -1;elsereturn 0;}}15import java.math.*;public class Exercise13_15 {public static void main(String[] args) {// Create and initialize two rational numbers r1 and r2.Rational r1 = new Rational(new BigInteger("4"), new BigInteger("2"));Rational r2 = new Rational(new BigInteger("2"), new BigInteger("3"));// Display resultsSystem.out.println(r1 + " + " + r2 + " = " + r1.add(r2));System.out.println(r1 + " - " + r2 + " = " + r1.subtract(r2));System.out.println(r1 + " * " + r2 + " = " + r1.multiply(r2));System.out.println(r1 + " / " + r2 + " = " + r1.divide(r2));System.out.println(r2 + " is " + r2.doubleValue());}static class Rational extends Number implements Comparable<Rational> { // Data fields for numerator and denominatorprivate BigInteger numerator = BigInteger.ZERO;private BigInteger denominator = BigInteger.ONE;/** Construct a rational with default properties */public Rational() {this(BigInteger.ZERO, BigInteger.ONE);}/** Construct a rational with specified numerator and denominator */ public Rational(BigInteger numerator, BigInteger denominator) {BigInteger gcd = gcd(numerator, denominator);if (pareTo(BigInteger.ZERO) < 0)this.numerator = numerator.multiply(new BigInteger("-1")).divide(gcd); elsethis.numerator = numerator.divide(gcd);this.denominator = denominator.abs().divide(gcd);}/** Find GCD of two numbers */private static BigInteger gcd(BigInteger n, BigInteger d) {BigInteger n1 = n.abs();BigInteger n2 = d.abs();BigInteger gcd = BigInteger.ONE;for (BigInteger k = BigInteger.ONE;pareTo(n1) <= 0 && pareTo(n2) <= 0;k = k.add(BigInteger.ONE)) {if (n1.remainder(k).equals(BigInteger.ZERO) &&n2.remainder(k).equals(BigInteger.ZERO))gcd = k;}return gcd;}/** Return numerator */public BigInteger getNumerator() {return numerator;}/** Return denominator */public BigInteger getDenominator() {return denominator;}/** Add a rational number to this rational */public Rational add(Rational secondRational) {BigInteger n = numerator.multiply(secondRational.getDenominator()).add( denominator.multiply(secondRational.getNumerator()));BigInteger d = denominator.multiply(secondRational.getDenominator()); return new Rational(n, d);}/** Subtract a rational number from this rational */public Rational subtract(Rational secondRational) {BigInteger n = numerator.multiply(secondRational.getDenominator()).subtract( denominator.multiply(secondRational.getNumerator()));BigInteger d = denominator.multiply(secondRational.getDenominator()); return new Rational(n, d);}/** Multiply a rational number to this rational */public Rational multiply(Rational secondRational) {BigInteger n = numerator.multiply(secondRational.getNumerator()); BigInteger d = denominator.multiply(secondRational.getDenominator()); return new Rational(n, d);}/** Divide a rational number from this rational */public Rational divide(Rational secondRational) {BigInteger n = numerator.multiply(secondRational.getDenominator()); BigInteger d = denominator.multiply(secondRational.numerator);return new Rational(n, d);}@Overridepublic String toString() {if (denominator.equals(BigInteger.ONE))return numerator + "";elsereturn numerator + "/" + denominator;}@Override /** Override the equals method in the Object class */public boolean equals(Object parm1) {if ((this.subtract((Rational)(parm1))).getNumerator().equals(BigInteger.ONE)) return true;elsereturn false;}@Override /** Override the hashCode method in the Object class */public int hashCode() {return new Double(this.doubleValue()).hashCode();}@Override /** Override the abstract intValue method in ng.Number */public int intValue() {return (int)doubleValue();}@Override /** Override the abstract floatValue method in ng.Number */public float floatValue() {return (float)doubleValue();}@Override /** Override the doubleValue method in ng.Number */public double doubleValue() {return numerator.doubleValue() / denominator.doubleValue();}@Override /** Override the abstract longValue method in ng.Number */public long longValue() {return (long)doubleValue();}@Overridepublic int compareTo(Rational o) {if ((this.subtract((Rational)o)).getNumerator().compareTo(BigInteger.ZERO) > 0)return 1;else if ((this.subtract((Rational)o)).getNumerator().compareTo(BigInteger.ZERO) < 0)return -1;elsereturn 0;}}}16public class Exercise13_16 {public static void main(String[] args) {Rational result = new Rational(0, 1);if (args.length != 1) {System.out.println("Usage: java Exercise13_16 \"operand1 operator operand2\"");System.exit(1);}String[] tokens = args[0].split(" ");switch (tokens[1].charAt(0)) {case '+': result = getRational(tokens[0]).add(getRational(tokens[2]));break;case '-': result = getRational(tokens[0]).subtract(getRational(tokens[2]));break;case '*': result = getRational(tokens[0]).multiply(getRational(tokens[2]));break;case '/': result = getRational(tokens[0]).divide(getRational(tokens[2]));}System.out.println(tokens[0] + " " + tokens[1] + " " + tokens[2] + " = " + result);}static Rational getRational(String s) {String[] st = s.split("/");int numer = Integer.parseInt(st[0]);int denom = Integer.parseInt(st[1]);return new Rational(numer, denom);}}/* Alternatively, you can use StringTokenizer. See Supplement III.AA on StringTokenizer as alternativeimport java.util.StringTokenizer;public class Exercise15_18 {public static void main(String[] args) {Rational result = new Rational(0, 1);if (args.length != 3) {System.out.println("Usage: java Exercise15_22 operand1 operator operand2");System.exit(0);}switch (tokens[1].charAt(0)) {case '+': result = getRational(tokens[0]).add(getRational(tokens[2]));break;case '-': result = getRational(tokens[0]).subtract(getRational(tokens[2]));break;case '*': result = getRational(tokens[0]).multiply(getRational(tokens[2]));break;case '/': result = getRational(tokens[0]).divide(getRational(tokens[2]));}。
133-final相关题型答案

Selinux #getenforce #setenforce Iptables #iptables –F #iptables –x #/etc/init.d/iptables save #cat /etc/sysconfig/iptables #service iptables stop #chkconfig iptables off # 基本网络设定 1.配置本机网络参数如下: eth0接口的IP静态地址为192.168.0.X/255.255.255.0。 默认网关为192.168.0.254。 指定DNS服务器, 先后顺序为127.0.0.1, 192.168.0.254, 域名搜索后缀为example.com。 指定本机主机名称为stationX.example.com。 运行命令host instructor.example.com显示结果为: instructor.example.com has address 192.168.0.254。运行命令ping instructor.example.com能够ping通。 2.用户test1以密码123登陆系统后, 能够运行startx -- :1命令成功。 3.系统重启后默认的启动级别为5。 4.将NTP服务器指定为192.168.0.254, 并保持ntpd服务在运行级别35下启动。 答1. #vi /etc/sysconfig/network-scripts/ifcfg-eth0与#vi/etc/sysconfig/network IPADDR=192.168.0.6 NETMASK=255.255.255.0 GATEWAY=192.168.0.254 #vi /etc/resolv.conf search example.com nameserver 192.168.0.254 nameserver 127.0.0.1 #hostname station6.example.com #vi /etc/sysconfig/network HOSTNAME=station6.example.com #vi /etc/hosts 192.168.0.6 station6.example.com station6 #service network restart 或#/etc/init.d/network restart #host instructor.example.com #ping instructor.example.com #system-config-network 答2. #useradd test1 #echo "123"|passwd --stdin test1 检查用户主目录和tmp目录剩余空间,和主目录权限。 答3. #vi /etc/inittab id:5:initdefault: 答4. #vi /etc/ntp.conf server 192.168.0.254 #chkconfig --level 35 ntpd on #chkconfig --list ntpd #service ntpd restart或#/etc/init.d/ntpd restart #system-config-date饿
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2. 晶体样品的衍射衬度及形成原理由样品各处衍射束强度的差异形成的衬度称为衍射衬度。或是由样品各处满足布拉格条件程度的差异造成的。衍射衬度成像原理如下图所示。
1、制备薄膜样品的基本要求是什么?具体工艺过程如何?双喷减薄与离子减薄各适用于制备什么样品? 答:基本要求: ① 薄膜样品的组织结构必须和大块样品相同。 ② 样品相对于电子束而言,必须有足够多的“透明度”。 ③ 薄膜样品应有一定的强度和刚度,在制备、夹持和操作的过程中,在一定的机械力的作用下不会引起变形或损坏。 ④ 在样品制备过程中不允许表面产生氧化和腐蚀。 工艺过程: ① 从实物或大块的试样上切割厚度为0.3~0.5nm厚的薄片。 ② 样品薄片的预减薄(机械法或化学法) ③ 最终减薄,达到电镜所需的透明度,包括双喷电解减薄和离子减薄,目前效率最高和操作最简单的方法是双喷电解减薄。 双喷减薄适用制备金属与部分合金样品。
① 不易于腐蚀的裂纹端试样 ② 非粉末冶金试样 ③ 组织中各相电解性能相差不大的材料 ④ 不易于脆断、不能清洗的试样 离子减薄适用制备 ① 不导电的陶瓷样品 ② 要求质量高的金属样品 ③ 不宜双喷电解的金属与合金样品
2、什么是衍射衬度?它与质厚衬度有什么区别? 答:由于样品中不同位相的衍射条件不同而造成的衬度差别叫衍射衬度。 它与质厚衬度的区别: ① 质厚衬度是建立在原子对电子散射的理论基础上的,而衍射衬度则是建立在晶体对电子衍射基础之上。 ② 质厚衬度利用样品薄膜厚度的差别和平均原子序数的差别来获得衬度,而衍射衬度则是利用不同晶粒的晶体学位相不同来获得衬度。 ③ 质厚衬度应用于非晶体复型样品成像中,而衍射衬度则应用于晶体薄膜样品成像中。
3、画图说明衍射成像原理,并说明什么是明场像、暗场像和中心暗场像? 答:设薄膜有A、B两晶粒,B内的某(hkl)晶面严格满足Bragg条件,且B晶粒内满足“双光束条件”,则通过(hkl)衍射使入射强度I0分解为Ihkl和IO-Ihkl两部分,A晶粒内所有晶面与Bragg角相差较大,不能产生衍射。 在物镜背焦面上的物镜光阑,将衍射束挡掉,只让透射束通过光阑孔进行成像(明场),此时,像平面上A和B晶粒的光强度或亮度不同,分别为 IA I0
IB I0-Ihkl
B晶粒相对A晶粒的像衬度为
0)(IIIIIIIhklABAB
明场成像:只让中心透射束穿过物镜光栏形成的衍衬像称为明场像。 暗场成像:只让某一衍射束通过物镜光栏形成的衍衬像称为暗场像。 中心暗场像:入射电子束相对试样倾斜入射,使衍射斑移到透镜的中心位置,该衍射束通过物镜光栏形成的衍衬像称为中心暗场成像。
4、什么是消光距离?影响消光距离的主要物性参数和外界条件是什么? 答:当波矢量为K的入射波到达样品上表面时,随即开始受到晶体内原子的相干散射,产生波矢量K’的衍射波,但是在此上表面附近,由于参与散射的原子或晶胞数量有限,衍射强度很小;随着电子波在晶体内深处方向上传播,透射波强度不断减弱,若忽略非弹性散射引起的吸收效应,则相应的能量转移到衍射波方向,使其强度不断增大。当电子波在晶体内传播到一定深度时,由于足够的原子或晶胞参与了散射,将使透射波的振幅Φ0下降为零,全部能量转移到衍射方向使衍射波振幅Φg上升为最大。又由于入射波与(hkl)晶面交成精确的布拉格角θ。那么由入射波激发产生的衍射波也与该晶面交成同样的角度,于是在晶体内逐步增强的衍射波也必将作为新的入射波激发同一晶面的二次衍射,其方向恰好与透射波的传播方向相同。随着电子波在晶体内深度方向上的进一步传播,能量转移过程将以反方向被重复,衍射波的强度逐渐下降而透射波的强度相应增大。 这种强烈动力学相互作用的结果,使I0和Ig在晶体深度方向发生周期性的振荡。振荡的深度周期叫做消光距离,记做εg。这里“消光”指的是尽管满足衍射条件,但由于动力学相互作用而在晶体内一定深度处衍射波(或透射波)的强度实际为零。 理论推导:
εg=gFndcos 又Vc=d(n1) εg=gcFVcos 影响εg的物性参数:d——晶面间距、n——原子面上单位体积内所含晶胞数、或 Vc——晶胞体积、Fg——结构因子 外界条件:加速电压、入射波波长λ、入射波与晶面交成成的布拉格角θ。
8、什么是缺陷不可见判据? 答:对于给定的缺陷,R(x,y,z)是确定的;g是用以获得衍射衬度的某一发生强烈衍射的晶面倒易矢量,即操作反射。 如果g · R=整数 (0,1,2,… ) 则α=2πg·R,e-iα=1 (α=2π的整数倍。)此时缺陷的衬度将消失,即在图像中缺陷不可见。 如果g · R ≠整数 ,则e-iα≠1, (α≠2π的整数倍。)此时缺陷的衬度将出现,即在图像中缺陷可见。 由g · R=整数所表示的“不可见性判据”,是衍衬分析中用以鉴定缺陷的性质并测定缺陷的特征参量的重要依据和出发点。 9、说明孪晶与层错的衬度特征,并用其各自的衬度原理加以解释。
10、要观察钢中基体和析出相的组织形态,同时要分析其晶体结构和共格界面的位向关 系,如何制备样品?以怎样的电镜操作方式和步骤来进行具体分析? 答:通过双喷减薄或离子减薄方法制备电镜样品,观察包括基体和析出相的区域,拍摄明、暗场照片;采用样品倾转,使得基体与析出相的界面与电子束平行,用选区光阑套住基体和析出相进行衍射,获得包括基体和析出相的衍射花样进行分析,确定其晶体结构及位向关系。
一、选择题 1、将某一衍射斑点移到荧光屏中心并用物镜光栏套住该衍射斑点成像,这是( C )。 A. 明场像;B. 暗场像;C. 中心暗场像;D.弱束暗场像。 2、 当t=5s/2时,衍射强度为( D )。 A.Ig=0;B. Ig<0;C. Ig>0;D. Ig=Imax。 3、 已知一位错线在选择操作反射g1=(110)和g2=(111)时,位错不可见,那么它的布氏矢量是( B )。 A. b=(0 -1 0);B. b=(1 -1 0);C. b=(0 -1 1);D. b=(0 1 0)。 4、 当第二相粒子与基体呈共格关系时,此时的成像衬度是( C )。 A. 质厚衬度;B. 衍衬衬度;C. 应变场衬度;D. 相位衬度。 5、当第二相粒子与基体呈共格关系时,此时所看到的粒子大小( B )。 A. 小于真实粒子大小;B. 是应变场大小;C. 与真实粒子一样大小;D. 远远大于真实粒子。
6、中心暗场像的成像操作方法是( C )。
A.以物镜光栏套住透射斑;B.以物镜光栏套住衍射斑;C.将衍射斑移至中心并以物镜光栏套住透射斑。
二、判断题 1、实际电镜样品的厚度很小时,能近似满足衍衬运动学理论的条件,这时运动学理论能很好地解释衬度像。( √ ) 2、厚样品中存在消光距离ξg,薄样品中则不存在消光距离ξg。( × ) 3、明场像是质厚衬度,暗场像是衍衬衬度。( × ) 4、晶体中只要有缺陷,用透射电镜就可以观察到这个缺陷。( × ) 5、等厚消光条纹和等倾消光条纹通常是形貌观察中的干扰,应该通过更好的制样来避免它们的出现。( × )
三、填空题 1、运动学理论的两个基本假设是 双光束近似 和 柱体近似 。 2、对于理想晶体,当 样品厚度 或 偏离矢量 连续改变时衬度像中会出现 等厚消光条纹 或 等倾消光条纹 。 3、对于缺陷晶体,缺陷衬度是由缺陷引起的 位移矢量 导致衍射波振幅增加了一个 附加位相角 ,但是若 附加的位相角α =2π的整数倍时,缺陷也不产生衬度。 4、一般情况下,孪晶与层错的衬度像都是平行 直线 ,但孪晶的平行线 间距不等 ,而层错的平行线是 等间距 的。 5、实际的位错线在位错线像的 一侧 ,其宽度也大大小于位错线像的宽度,这是因为位错线像的宽度是 应变场 宽度。
四、名词解释 1、明场像:让透射束通过物镜光阑而把衍射束挡掉得到图像衬度的方法,叫明场成像,所得到的像叫明场像。 2、暗场像:用物镜光阑挡住透射束及其余衍射束,而只让一束强衍射束通过光阑参与成像的方法,称为暗场成像,所得图象为暗场像。 3、中心暗场像:用物镜光阑挡住透射束及其余衍射束,而只让一束强衍射束通过光阑参与成像的方法,称为暗场成像,所得图象为暗场像。如果物镜光阑处于光轴位置,所得图象为中心暗场像。 5、消光距离ξg:晶体内透射波与衍射波动力学相互作用,使其强度在晶体深度方向上发生周期性振荡,振荡的深度周期叫消光距离。 6、衍射衬度:入射电子束和薄晶体样品之间相互作用后,样品内不同部位组织的成像电子束在像平面上存在强度差别的反映。 衍射衬度主要是由于晶体试样满足布拉格反射条件程度差异以及结构振幅不同而形成电子图象反差。
五、问答题 1、用缺陷晶体衍衬运动学基本方程解释衬度形成原理。
答:缺陷晶体的衍射波振幅为:柱体)(ieigg
与理想晶体相比较,可发现由于晶体的不完整性,在缺陷附近的点阵畸变范围内衍射振幅的表达式中出现了一个附加的位相因子e-iα,其中附加的位相角α=2πg·R。所以,一般地说,附加位相因子e-iα引入将使缺陷附近物点的衍射强度有别于无缺陷的区域,从而使缺陷在衍衬图像中产生相应的衬度。 2、用理想晶体衍衬运动学基本方程解释等厚条纹与等倾条纹。 答:通过对双光束近似和柱体近似的假设,我们得到理想晶体衍射强度公式
2222
)()(sinsst
Igg
等厚条纹:如果晶体保持在确定的位向,则衍射晶体偏离矢量s保持恒定,此时上式可以改写为Ig=sin2(πts)/(sξg)2 显然,当s为常数时,随样品厚度t的变化,衍射强度将发生周期性的振荡,振荡度周期为tg=1/s 这就是说,当t=n/s(n为整数)时,Ig=0;而当t=(n+1/2)/s时,衍射强度为最大Igmax=1/( sξg)2。Ig随t周期性振荡这一运动学结果,定性的解释了晶体样品楔形边缘处出现的厚度消光条纹。根据式 Ig=sin2(πts)/(sξg)2 的计算,在衍射图像上楔形边缘上将得到几列亮暗相间的条纹,每一亮暗周期代表一个消光距离的大小,此时tg=ξg=1/s。因为同一条纹上晶体的厚度是相同的,所以这种条纹叫做等厚条纹,所以,消光条纹的数目实际上反映了薄晶体的厚度。 等倾条纹:如果把没有缺陷的薄晶体稍微弯曲,则在衍衬图像上可以出现等倾条纹。此时薄