GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Modify the selection sort algorithm to sort an array of obje…

Modify the selection sort algorithm to sort an array of objects that implement the Comparable interface (without using generics). Create a Student class with attributes such as name and assignmentScore, and implement the Comparable interface to define the sorting order. Use your modified selection sort algorithm to sort an array of Student objects based on their assignment scores. You are given the following student class class Student implements Comparable {                  String name;                  int assignmentScore;                // Constructor              public Student(String name, int assignmentScore) {                      this.name = name;                     this.assignmentScore = assignmentScore;              }            // compareTo method (descending order by score)          @Override            public int compareTo(Object other) {                              Student s = (Student) other;                           // Descending order                         return s.assignmentScore – this.assignmentScore;             }           // toString method        @Override             public String toString() {                                   return name + ” – ” + assignmentScore;           }}   fill in the selection sort algorithm to sort an array of objects that implement the Comparable interface (without using generics).   public class SelectionSortStudents {                     // Selection sort for Student objects                public static void selectionSort(Student[] arr) {                            //initialize variable n equals to length of array              //ADD YOU CODE HERE                               for (int i = 0; i < n - 1; i++) {                                             // Assume current position has max at index i             //ADD YOU CODE HERE                                           for (int j = i + 1; j < n; j++) {                            // Find index of largest element j and assign the maxindex to index of largest element             //ADD YOU CODE HERE                                             }                                     }               //         // Swap the element at index I and index j              //ADD YOU CODE HERE              }}

Read Details

In some countries, an accused person may be tried and convic…

In some countries, an accused person may be tried and convicted of a crime without being present and without knowing that a trial has taken place. This procedure is referred to as ________________________

Read Details

Write a void method selectionSortDescendTrace() that takes a…

Write a void method selectionSortDescendTrace() that takes an integer array, and sorts the array into descending order. The method should use nested loops and output the array after each iteration of the outer loop, thus outputting the array N-1 times (where N is the size). Complete main() to read in a list of up to 10 positive integers (ending in -1) and then call the selectionSortDescendTrace() method. For coding simplicity, output a space after every integer, including the last one on each row. If the input is: 20 10 30 40 -1 then the output is: 40 10 30 20 40 30 10 20 40 30 20 10 Complete the following solution of this problem import java.util.Scanner;public class SelectionSortTrace {public static void selectionSortDescendTrace(int[] arr, int size) {                   for (int i = 0; i < size - 1; i++) {               // Assume current position has max at index i             //ADD YOU CODE HERE                                for (int j = i + 1; j < size; j++) {                             // Find index of largest element j and assign the maxindex to index of largest element             //ADD YOU CODE HERE                           }                // Swap the element at index I and index j             //ADD YOU CODE HERE              // Print array after each outer loop iteration use following loop              for (int k = 0; k < size; k++) {              //ADD YOU CODE HERE            }           System.out.println();     }}public static void main(String[] args) {                Scanner sc = new Scanner(System.in);                // Declare an array of size 10             //ADD YOU CODE HERE              while (size < 10) {                       //Read up to 10 positive integers from input. Stop reading when -1 is entered.              //ADD YOU CODE HERE                    //Store the values resd from keyboard in an array and move to next index             //ADD YOU CODE HERE               }             //Make a recursive Call selectionSortDescendTrace() with the array.              //ADD YOU CODE HERE      }}

Read Details

Write a Java program to determine whether a given word or ph…

Write a Java program to determine whether a given word or phrase is a palindrome using a recursive method. A palindrome is a sequence that reads the same forward and backward (e.g., madam, racecar, A man a plan a canal Panama). Solution:  Write a method that returns true if input string is palindrome //Base case: if string has 0 or 1 character, it’s a palindrome // Compare first and last character if they are not equal return false //Make a recursive call on substring excluding first and last 2 . write main method with following steps //Prompt the user to enter a string. // Remove spaces and convert to lowercase // Check palindrome using recursion Display an appropriate message indicating whether the input is a palindrome.

Read Details

 Mark each as Completed (Yes)  or Not (No)  Show a complete…

 Mark each as Completed (Yes)  or Not (No)  Show a complete 360-degree scan of your work area, including the computer table, keyboard, underneath and around the table, and the entire room, showing everything clearly on camera while counting slowly to 30 out loud. Show the work area clearly during the room scan. This also ensures that your microphone is working: [scan-mic] Work area clear except ripped  paper/calculator/pen only: [work-clear] Show powered off  your cell phone/devices on camera placed away from the testing area : [phone-off] My webcam was positioned to provide a clear, unobstructed view of your entire face, hands, and desk area as shown in the sample images in canvas at all times.   [webcam-view] I followed all the instructions provided in the online exam guidelines document throughout the exam. I understand that failure to follow these instructions will result in a grade of zero on the exam. I also understand that failure to follow any of the above instructions is a scholastic dishonesty violation and will be referred to the Dean of Students Office. Scholastic dishonesty will result in a course grade of F.  [guidelines-followed]

Read Details

** Mark each as Completed (Yes – Completed) or Not (No – Not…

** Mark each as Completed (Yes – Completed) or Not (No – Not completed):**   Show a complete 360-degree scan of your work area, including the computer table, keyboard, underneath and around the table, and the entire room, showing everything clearly on camera while counting slowly to 30 out loud. Show the work area clearly during the room scan. This also ensures that your microphone is working: [scan-mic] Work area clear except scratch paper/calculator/pen only: [work-clear] Turn on your webcam in Honorlock to see yourself on the screen [webcam-on] Powered off  your cell phone on camera: [phone-off] Keep the cellphone away from the testing area out of hands reach but visible on camera to ensure that you are not using it during the test. Using or checking phones or other electronic devices during the test is not permitted: [phone-away] Ensure your webcam is positioned to provide a clear, unobstructed view of your entire face, hands, and desk area as shown in the sample images in canvas at all times. Your full face must be visible at all times, and your eyes should remain focused on the screen throughout the exam, except when using scratch paper: [webcam-view] Suggestions that might help fitting everything into view, when using a laptop. Try slightly elevating your laptop If you have any thick books, sturdy boxes, binders, or even a shoebox, those could also work under your laptop, just make sure whatever you use is flat and steady.  This would help to get a wider angle that can capture both your face and your workspace. Use an external webcam if you have access to one. It gives more flexibility in positioning the camera. Angle your laptop screen back a bit more than usual to widen the view to ensure your face remains visible. Consider placing a mirror behind you if you’re unable to fit the desk on screen; this could help reflect your workspace while keeping your face in view. You can sit diagonally at the table to increase the distance between yourself and the camera. This can help ensure your face, hands, and desk area are visible in the frame, as required. Show that all other electronic devices are turned off and kept out of reach including additional monitors in the room: [devices-off] Students should simulate classroom testing condition by taking each exam at a desk or table. Tests should not be taken on a bed, couch, or other informal setting: [desk-chair] Take the exam in a well-lit room. A clear and well-lit image of the student’s face must be fully visible, and all sounds must be clearly audible at all times: [light-sound] No other persons should be present in the room during the exam : [no-persons] Make sure, before beginning the exam, all additional applications are closed, with the exception of Google Chrome. On Mac computers, this can be done by selecting the Apple icon at the top left of the screen and choosing Force Quit, while Windows users can close applications by right clicking the application icon and selecting Close: [apps-closed] Students may not cover/obstruct the camera lens, point the camera lens away from their face, or  blur the camera during the exam: [no-camera-block] You must also follow all the instructions provided in the online exam guidelines document throughout the exam. Failure to follow these instructions will result in grade zero for the exam: [guidelines-followed] I understand that failure to follow these instructions will result in a grade of zero on the exam. I also understand that failure to follow any of the above instructions is a scholastic dishonesty violation and will be referred to the Dean of Students Office. Scholastic dishonesty will result in a course grade of F.  [dos-grade]

Read Details

Mark each as Completed (Yes)  or Not (No)  Clear the calcul…

Mark each as Completed (Yes)  or Not (No)  Clear the calculator (memory) before starting the exam on camera: [RAM-cleared] Instructions  on how to Clear RAM (TI-84 Plus family calculators) This will delete programs that you may have stored, and all data in RAM memory: Press 2nd ;mem; 7; Reset, to highlight the RAM menu Select 1: All RAM… At the RESET RAM screen, select 2: Reset When complete, the display will show RAM Cleared Show the “memory cleared or RAM cleared ” calculator screen on camera. Show  scratch paper and formula card clearly on camera and keep them in visible writing area entire exam: [scratch-formula] I understand that failure to follow these instructions will result in a grade of zero on the exam. I also understand that failure to follow any of the above instructions is a scholastic dishonesty violation and will be referred to the Dean of Students Office. Scholastic dishonesty will result in a course grade of F. [guidelines-followed]

Read Details

Mark each as Completed (Yes – Completed) or Not (No – Not co…

Mark each as Completed (Yes – Completed) or Not (No – Not completed):**   You must show the formula sheet and scratch paper at the end of the test on camera: [show-scratch] Rip the formula sheet and scratch paper on camera. Show the ripped pages on camera: [rip-paper] Clear the calculator (memory) on camera: [RAM-cleared] Instructions  on how to Clear RAM (TI-84 Plus family calculators) This will delete programs that you may have stored, and all data in RAM memory: Press 2nd ; mem; 7; Reset, to highlight the RAM menu Select 1: All RAM… At the RESET RAM screen, select 2: Reset When complete, the display will show RAM Cleared Show the “memory cleared or RAM cleared ” calculator screen on camera. I understand that failure to follow these instructions will result in a grade of zero on the exam. I also understand that failure to follow any of the above instructions is a scholastic dishonesty violation and will be referred to the Dean of Students Office. Scholastic dishonesty will result in a course grade of F. [guidelines-followed]

Read Details

Problem 4 Question f goes here.

Problem 4 Question f goes here.

Read Details

Problem 3 goes here.

Problem 3 goes here.

Read Details

Posts pagination

Newer posts 1 … 29 30 31 32 33 … 81,268 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top