Question
Using Java, Must utilize arrays, static methods, loops and decision making constructs Please put each part in its own project. Part 1 1. Convert 1001011
Using Java,
Must utilize arrays, static methods, loops and decision making constructs Please put each part in its own project.
Part 1 1. Convert 1001011 from binary to decimal. 2. Convert 1101110 from decimal to binary. Using arrays write functions to convert values from binary to decimal and decimal to binary.
Part 2 Your instructor has asked you to write a program that grades a test. The test has 15 multiple choice questions. Here are the correct answers:
1. B 2. D 3. A 4. A 5. C 6. D 7. A 8. B 9. C 10. A 11. B 12. C 13. D 14. A 15. B
A student must correctly answer 12 out of the 15 questions to pass the test.
Write a program that holds the correct answers to the test in an array. The program should have an array that hold's the student's answers. The program should have the following static methods: a. passed() returns true if the student passed the test or false if the student failed. b. totalCorrect() - Return the total number of correctly answered questions. c. totalIncorrect() - Returns the total number of incorrectly answered questions. d. An int array containing the questions numbers of the questions that the student missed.
Demonstrate the program by setting the values of student's answers in main(You are not required to prompt the user to enter values using Scanner or System.in.read()), and then display the result returned from the methods written in the program.
Here are some suggestions on variable and method declarations. char [] coorectAns = new char[15]; char [] studentAns = new char[15];
static boolean passed(char [] correct, char [] student) { } static int totalCorrectAnswers(char [] correct, char [] student) { } static int totalInCorrectAnswers(char [] correct, char [] student) { } static int [] questionNumbersMissed(char [] correct, char [] student) { //which questions were either not answered or were incorrect. //declaring a char array that keeps track of the questions that were incorrectly answered. }
Part 3 Write a program that lets the user enter four quarterly sales figures for six divisions of a company. The figures should be stored in a two dimensional array. Once the figures are entered the program should display the following for each quarter
a. A list of the sales figures by division. b. Each division increases or decreases from the previous quarter(this will not be displayed for the first quarter). c. The total sales for the quarter. d. The company's increase or decrease from the previous quarter(this will not be displayed for the first quarter). e. The average sales for all divisions that quarter. f. The division with the highest sales for that quarter.
Input Validation: Do not accept negative numbers for sales figures.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started