Answer:
import java.io.*;
import java.util.Scanner;
public class CountWordsInFile {
public static void main(String[] args) throws IOException {
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter file name: ");
String fileName = keyboard.next();
File file = new File(fileName);
try {
Scanner scan = new Scanner(file);
int count = 0;
while(scan.hasNext()) {
scan.next();
count += 1;
}
scan.close();
System.out.println("Number of words: "+count);
} catch (FileNotFoundException e) {
System.out.println("File " + file.getName() + " not present ");
System.exit(0);
}
}
}
Answer:
Code is given below:
Explanation:
.data
str1: .space 20
str2: .space 20
msg1:.asciiz "Please enter string (max 20 characters): "
msg2: .asciiz "\n Please enter string (max 20 chars): "
msg3:.asciiz "\nSAME"
msg4:.asciiz "\nNOT SAME"
.text
.globl main
main:
li $v0,4 #loads msg1
la $a0,msg1
syscall
li $v0,8
la $a0,str1
addi $a1,$zero,20
syscall #got string to manipulate
li $v0,4 #loads msg2
la $a0,msg2
syscall
li $v0,8
la $a0,str2
addi $a1,$zero,20
syscall #got string
la $a0,str1 #pass address of str1
la $a1,str2 #pass address of str2
jal methodComp #call methodComp
beq $v0,$zero,ok #check result
li $v0,4
la $a0,msg4
syscall
j exit
ok:
li $v0,4
la $a0,msg3
syscall
exit:
li $v0,10
syscall
methodComp:
add $t0,$zero,$zero
add $t1,$zero,$a0
add $t2,$zero,$a1
loop:
lb $t3($t1) #load a byte from each string
lb $t4($t2)
beqz $t3,checkt2 #str1 end
beqz $t4,missmatch
slt $t5,$t3,$t4 #compare two bytes
bnez $t5,missmatch
addi $t1,$t1,1 #t1 points to the next byte of str1
addi $t2,$t2,1
j loop
missmatch:
addi $v0,$zero,1
j endfunction
checkt2:
bnez $t4,missmatch
add $v0,$zero,$zero
endfunction:
jr $ra
Answer:
Q = 63,827.5 W
Explanation:
Given:-
- The dimensions of plate A = ( 10 mm x 1 m )
- The fluid comes at T_sat , 1 atm.
- The surface temperature, T_s = 75°C
Find:-
Determine the total condensation rate of water vapor onto the front surface of a vertical plate
Solution:-
- Assuming drop-wise condensation the heat transfer coefficient for water is given by Griffith's empirical relation for T_sat = 100°C.
h = 255,310 W /m^2.K
- The rate of condensation (Q) is given by Newton's cooling law:
Q = h*As*( T_sat - Ts )
Q = (255,310)*( 0.01*1)*( 100 - 75 )
Q = 63,827.5 W
Answer:
where are the answer chioces
Explanation:
Answer:
The speed of shaft is 1891.62 RPM.
Explanation:
given that
Amplitude A= 0.15 mm
Acceleration = 0.6 g
So
we can say that acceleration= 0.6 x 9.81

We know that

So now by putting the values



We know that
ω= 2πN/60
198.0=2πN/60
N=1891.62 RPM
So the speed of shaft is 1891.62 RPM.