Answer:
- import java.util.Scanner;
- public class TryToParseDouble {
-
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- double num;
-
- try{
- System.out.print("Input a number: ");
- num = Double.parseDouble(input.nextLine());
-
- }catch(NumberFormatException e){
- num = 0;
- System.out.println("Invalid input! It should be a number in double type");
- }
- System.out.println(num);
- }
- }
Explanation:
Firstly, create a Scanner object to get user input (Line 5).
Next, create a try block and prompt user to input a number and use Double.parseDouble() method to convert the input to double type in the block (Line 8-10).
Next, create a catch block to catch a NumberFormatException. In the Catch block, set the num to zero and then print out a message to inform user about the invalid input (Line 12-14).
Lastly, display the number (Line 16).
Answer: a) 0.24E+20 m-3. b) p-type extrinsic.
Explanation:
The current density in a semiconductor is composed by two types of charge carriers: electrons and holes.
This parameter, is proportional to the Electric field within the semiconductor, being the proportionality constant, the electrical conductivity of the material, that takes into account the charge carrier concentrations, and the mobility for each type.
The expression for electrical conductivity is as follows:
σ = q . ne . µe + q . np . µp
Replacing by the given values, and the value of q (charge of an electron), we can get the only unknown that remains, ne , as follows:
ne =( σ – (q . np . µp)) / q µe = (13 (Ω.m)-1 – (1.6E-19) coul(4.0E+20) m-3.0.18) m2/V-s /( (1.6E-19).0.38) coul.m2/V-s
ne = 0.24E+20.
As ne is smaller than np, this means that the semiconductor behaves like a p-type extrinsic one.