subject

LAB: Divide input integers Write a program using integers userNum and divNum as input, and output userNum divided by divNum three times. Note: End with a newline.
Ex: If the input is:
2000 2
the output is:
1000 500 250
Note: In Java, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
import java. util. Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
}
}
(My professor wants us to use this temple and I'm not sure how I should start typing the code were it says "type code here". I've tried differnt forms like the one provided below but they all have errors according to the program. it tells me that i have to place ; .
import java. util. Scanner;
public class LabProgram {
public static void main(String[] args) {
userNum= int(input())
divNum= int(input())
# calculating the division three times
userNum=userNum//divNum
#i have used end=' ' so that it does not produce new line
# instead of that it produce space
print(userNum, end=' ')
userNum=userNum//divNum
print(userNum, end=' ')
userNum=userNum//divNum
print(userNum, end=' ')
}
}
Errors:
Program errors displayed here
LabProgram. java:5: error: '.class' expected userNum= int(input()) ^ LabProgram. java:5: error: ';' expected userNum= int(input()) ^ LabProgram. java:6: error: '.class' expected divNum= int(input()) ^ LabProgram. java:6: error: ';' expected divNum= int(input()) ^ LabProgram. java:7: error: illegal character: '#' # calculating the division three times ^ LabProgram. java:7: error: ';' expected # calculating the division three times ^ LabProgram. java:7: error: ';' expected # calculating the division three times ^ LabProgram. java:9: error: illegal character: '#' #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:10: error: illegal character: '#' # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:11: error: ';' expected print(userNum, end=' ') ^ LabProgram. java:12: error: ';' expected userNum=userNum//divNum ^ LabProgram. java:13: error: ';' expected print(userNum, end=' ') ^ LabProgram. java:14: error: ';' expected userNum=userNum//divNum ^ LabProgram. java:15: error: ';' expected print(userNum, end=' ') ^ 22 errors

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
You can apply several different worksheet themes from which tab?
Answers: 1
question
Computers and Technology, 24.06.2019 20:30
Which key should you press to leave the cell as it originally was? a. delete b. cancel c. backspace d. enter
Answers: 1
question
Computers and Technology, 25.06.2019 08:00
In designing a management information system (mis), after defining the system's objectives, the next step is to information in a useful formatintegrate the hardware and software componentscollect and analyze datause information for decision making
Answers: 2
You know the right answer?
LAB: Divide input integers Write a program using integers userNum and divNum as input, and output u...
Questions
question
Spanish, 30.10.2021 04:30
question
Mathematics, 30.10.2021 04:30
Questions on the website: 13722360