Questions
C++ Chapter 4/5 Lab Assignment Using concepts from chapters 1 – 5 only. Grading will be...

C++ Chapter 4/5 Lab Assignment Using concepts from chapters 1 – 5 only. Grading will be based on chapter 4 concepts more. Design a menu driven program that can keep track of five player’s scores. Your program must have the following documentation: A. Your name B. The program name C. Program Description D. The date the exe file was created E. The code: a. Use a menu approach do the following: i. to Add a player information ii. to Search for any player based on their name. iii. to Display all the information at any time (Hint : Use value and reference parameters as necessary).. b. Organize the main program to call input and output functions. Use static variables to keep track of player’s information. c. Input the names of five players and their highest scores on three games they ever played. Do Not Hard-Code the players’ names and their scores. d. Create an average function to compute the average highest score of each player i.e. ( john: g1 100 g2 200 g3 300. Average highest score will be 200.00).

In: Computer Science

Convert the following C function to the corresponding MIPS assembly procedure: int count(int a[], int n,...

Convert the following C function to the corresponding MIPS assembly procedure:
int count(int a[], int n, int x)
{
int res = 0;
int i = 0;
int j = 0;
int loc[];
for(i = 0; i != n; i++)
if(a[i] == x) {
res = res + 1;
loc [j] = i;
j = j+1}
return res, loc;
}

In: Computer Science

implement the algorithm described in this chapter to convert a prefix expression to postfix form. involve...

implement the algorithm described in this chapter to convert a prefix expression to postfix form. involve the classes that programming problems 4 and 5 describe

This is to be written in C++. I cannot provide anymore information, I cannot provide any class information, etc. This is all the problem that book gave me. This is for Data Structures and algorithms.

In: Computer Science

Convert the following C function to the corresponding MIPS assembly procedure: int count(int a[], int n,...

Convert the following C function to the corresponding MIPS assembly procedure:
int count(int a[], int n, int x)
{
int res = 0;
int i = 0;
int j = 0;
int loc[];
for(i = 0; i != n; i++)
if(a[i] == x) {
res = res + 1;
loc [j] = i;
j = j+1}
return res, loc;
}

In: Computer Science

Write a value returning function named CountLower that counts the number of lower case letters on...

Write a value returning function named CountLower that counts the number of lower case letters on one line of standard input and returns that number. Document the dataflow of the function and show how it would be called from main().

In: Computer Science

Registry Java Programming 3) Planner Create a class called Planner. A Planner is a data structure...

Registry Java Programming

3) Planner

Create a class called Planner. A Planner is a data structure for storing events. The maximum capacity of the planner (physical size) is specified by the formal parameter of the constructor of the class.

Instance methods

  • int size(); returns the number of events that are currently stored in this Planner (logical size);

  • boolean addEvent( AbstractEvent event ); adds an event to the last position of
    this Planner. It returns true if the insertion was a success, and false if this Planner was already full;

  • AbstractEvent eventAt( int pos ); returns the event at the specified position in
    this Planner. This operation must not change this state of this Planner. The first event of the Planner is at position 0;

  • AbstractEvent remove( int pos ); removes the event at the specified position of
    this Planner. Shifts any subsequent items to the left (start of the array). Returns the event that was removed from this Planner;

  • void display( Date date ); the method display prints all the events that have a recurrence on the specified date;

  • void sort( Comparator< AbstractEvent > c ), the method passes the array of events and the comparator object to the method java.util.Arrays.sort;

The class overrides the method String toString(). An example of the expected format is given below.

4) Notifications:

Create a class called notifications that is sensitive to changes in the planner. Every time an item shows up in planner, the notifications class will display some kind of notification automatically on the screen. You need to use the observer design pattern.

These are the abstract classes:

// AbstractEvent.java : Java class to represent the AbstractEvent
import java.util.Date;

public abstract class AbstractEvent {
  
   // data fields
   private String description;
   private Date start_time;
   private Date end_time;
  
   // method to set the description of the AbstractEvent
   public void setDescription(String description)
   {
       this.description = description;
   }
  
   // method to set the start date for the AbstractEvent
   public void setStartTime(Date start)
   {
       this.start_time = start;
   }
  
   // method to set the end date for the AbstractEvent
   public void setEndTime(Date end)
   {
       this.end_time = end;
   }
  
   // method to return the description of the AbstractEvent
   public String getDescription()
   {
       return description;
   }
  
   // method to return the start date of AbstractEvent
   public Date getStartTime()
   {
       return start_time;
   }
  
   // method to return the end date of the AbstractEvent
   public Date getEndTime()
   {
       return end_time;
   }
  
   // The below 3 methods must be define by the concrete subclass of AbstractEvent
   // abstract method hasMoreOccurrences() whose implementation depends on the kind of event
   public abstract boolean hasMoreOccurrences();
   // abstract method nextOccurrence() whose implementation depends on the kind of event
   public abstract Date nextOccurrence();
   // abstract method init() whose implementation depends on the kind of event
   public abstract void init();
  
}
//end of AbstractEvent.java

1.2

//DailyEvent.java
import java.util.Calendar;
import java.util.Date;

public class DailyEvent extends AbstractEvent{
  
   // data field to store the number of recurrences
   private int num_consecutive_days;
   // helper field to return the next occurrence
   private int days_occurred = 0;
  
   // method to set the number of recurrences
   public void setNumberOfConsecutiveDays(int num_days)
   {
       this.num_consecutive_days = num_days;
   }

   // method to get the number of recurrences
   public int getNumberOfConsecutiveDays()
   {
       return num_consecutive_days;
   }
  
   // method to return if the event has more occurrences or not
   @Override
   public boolean hasMoreOccurrences() {
       // if days occurred < number of consecutive days , then next occurrence is valid
       if(days_occurred < num_consecutive_days)
           return true;
       return false;
   }

   // method to return the date of next occurrence
   @Override
   public Date nextOccurrence() {
      
       // if days_occurred >= number of recurrences, return null (as it exceeds number of recurrences)
       if(days_occurred >= num_consecutive_days)
           return null;
      
       // return the next occurrence date
       Calendar cal = Calendar.getInstance();
       cal.setTime(getStartTime());
       cal.add(Calendar.DATE, days_occurred);
       days_occurred++; // increment the number of days by a day
       return cal.getTime();
   }

   // method to re-initialize the state of the object so that a call to the method nextOccurrence() returns the date of the first occurrence of this event
   @Override
   public void init() {
       days_occurred = 0;
      
   }
   public String toString()
   {
       return("Start Date: "+getStartTime()+" End Date : "+getEndTime()+" Consecutive days of occurrence : "+num_consecutive_days);
   }


}
//end of DailyEvent.java

1.3

//WeeklyEvent.java
import java.util.Calendar;
import java.util.Date;

public class WeeklyEvent extends AbstractEvent{

   // data field to store the limit date
   private Date limit;
   // helper field to return the next occurrence
   private int num_days = 0;
  
   // method to set the limit date
   public void setLimit(Date limit)
   {
       this.limit = limit;
   }
  
   // method to return the limit date
   public Date getLimit()
   {
       return limit;
   }
  
  
   // method to return if the event has more occurrences or not
   @Override
   public boolean hasMoreOccurrences() {
      
       // check if the call to nextOccurrence will return a date within the limit
       Calendar cal = Calendar.getInstance();
       cal.setTime(getStartTime());
       cal.add(Calendar.DATE, num_days);
      
       if(cal.getTime().compareTo(limit) < 0)
           return true;
      
       return false;
   }

   // method to return the next occurrence date
   @Override
   public Date nextOccurrence() {
      
       Calendar cal = Calendar.getInstance();
       cal.setTime(getStartTime());
       cal.add(Calendar.DATE, num_days);
       // if next occurrence date > limit , return null, else return the next occurrence date
       if(cal.getTime().compareTo(limit) >= 0)
           return null;
       num_days += 7; // increment the number of days by 1 week
       return cal.getTime();
   }

   // method to re-initialize the state of the object so that a call to the method nextOccurrence() returns the date of the first occurrence of this event
   @Override
   public void init() {
       num_days = 0;
   }
  
   public String toString()
   {
       return("Start Date: "+getStartTime()+" End Date : "+getEndTime()+" Limit Date : "+limit);
   }

}
//end of WeeklyEvent.java

In: Computer Science

Discuss the process of folder and file auditing and the benefits thereof.

Discuss the process of folder and file auditing and the benefits thereof.

In: Computer Science

Design an activities page to make this web site complete. a.Use your imagination to create at...

Design an activities page to make this web site complete. a.Use your imagination to create at least four activities. b.Organize these activities in a table. c.Some activities are free but some may charge some fee. d.Once again, the correct resort title and navigation menu bar shall be included.e.Include an image for each activity. Make sure the images’ size are the same.f.When mouse hovers on any image, its size will be enlarged.

In: Computer Science

Registry Java Programming 2) Interface Comparator: The method for comparing two objects is written outside of...

Registry Java Programming

2) Interface Comparator:

The method for comparing two objects is written outside of the class of the objects to be sorted. Several methods can be written for comparing the objects according to different criteria. Specifically, write three classes, DescriptionComparator, FirstOccComparator,
and LastOccComparator that implement the interface java.util.Comparator.

  • DescriptionComparator implements the interface Comparator. The
    method compare compares the description of two objects. It returns a negative value if the description of the first object comes before the description of the second object in the lexicographic order, 0 if both descriptions are logically the same, and a positive number if the description of the first object comes after the description of the second object in the lexicographic order;

  • FirstOccComparator implements the interface Comparator. It compares the start time of two events. It returns a negative value if the start time of the first event is before that of the second event, 0 if both start times are logically the same, and a positive number if the start time of the first event is after the start time of the second event;

LastOccComparator implements the interface Comparator. It compares the dates of the last recurrences of two events. It returns a negative value if the date of the last recurrence of the first event is before that of the last recurrence of the second event, 0 if the date of the last recurrence of both events is logically the same, and a positive number if the date the last recurrence of the first event is after the date of the last recurrence of the second event.

In: Computer Science

Create a void function named swap that accepts two int parameters and swaps their values. Provide...

Create a void function named swap that accepts two int parameters and swaps their values. Provide a main function demonstrating a call to the swap function. Document the dataflow of the function.

In: Computer Science

use c++ /* The following function receives the class marks for all student in a course...

use c++

/*
The following function receives the class marks for all student in a course and compute standard deviation. Standard deviation is the average of the sum of square of difference of a mark and the average of the marks. For example for marks={25, 16, 22}, then average=(25+16+22)/3=21. Then standard deviation = ((25-21)^2 + (16-21)^2+(22-21)^2)/3.
Implement the function bellow as described above. Then write a test console app to use the function for computing the standard deviation of a list of marks that user inputs as floats in the range of 0.f to 100.f. User signals end of the list by entering -1 as final mark. Make sure to verify user input marks are valid and in the range, before processing them.

*/

float ComputeMarksStandardDeviation(std::array<float> marks)
{
}

In: Computer Science

Consider the following code: import java.util.Scanner; public class Main {    public static void main(String[] args)...

Consider the following code:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

String input = "";

System.out.println("Enter the first number: ");
  
input = in.nextLine();
int a = 0;
int b = 0;
  
a = Integer.parseInt(input);
  
System.out.println("Enter the second number: ");
input = in.nextLine();
  
b = Integer.parseInt(input);
  
int result = 0;

result = a/b;
  
System.out.println("a/b : " + result);

   }


Copy the code to your Main.java file and run it with the following inputs:
34 and 0;
‘Thirty-four’ as the first input.

What prevented the program from running successfully?

Update the code, so that it can handle cases a) and b).

Please note the following:
You have to use try-catch to handle exceptions.
To determine exception classes, that you need to catch, use error message from the respective case (a) and b)). Hint: to handle String-to-integer conversion, use NumberFormatException;
Exceptions should be caught so that:
Code never crashes due to non-numeric input (both for first and second values);
Code never crashes due to division by zero;
If non-numeric value is entered for a or b, program should output "Error: entered value is not an integer number. Exiting..." and exit (use System.exit(0); to exit);
If zero value is entered for b, program should output " Error: cannot divide by zero. Exiting..." and exit (use System.exit(0); to exit);
Hints: Use 3 try-catch blocks in total. Try block should only contain the command, that can throw an exception.

In: Computer Science

Please make a Python program where the computer chooses a number and the player guesses the...

Please make a Python program where the computer chooses a number and the player guesses the number.

You need an input, a random number, if statement, and a while loop.

Please reference these when doing the code:

((random reference))

•>>> import random

•>>> random.randint(1, 100)

•67

((While & if referefence))

•>>> cnum = 3

•>>>while true

•>>> if cnum == 3:

•>>> print(‘correct’)

•>>> break

•>>> elif cnum == 2:

•>>> print(‘incorrect’)

Please prepare a Word document that has the Python code and the screen shot of your output.

Here is a sample output screen.

What is your guess? 97

Too high

What is your guess? 6

Too low

What is your guess? 82

Too high

What is your guess? 23

Too low

What is your guess? 64

Too high

What is your guess? 46

Too high

What is your guess? 35

Too low

What is your guess? 40

Too high

What is your guess? 37

Too low

What is your guess? 39

Too high

What is your guess? 38

Correct !

>>>

In: Computer Science

C Programming Number output lines of a text file as it prints to the terminal Do...

C Programming

Number output lines of a text file as it prints to the terminal

Do not use fgets or fopen

It is possible to open file without fopen using SyS commands such as open and RDONLY

Example

1 Line 1

2 Line2

In: Computer Science

Create a variable named specChars and assign it the values of all the punctuation items available...

Create a variable named specChars and assign it the values of all the punctuation items available on the top row of the keyboard, starting with the value above the number 1 through the value above the number 0. For example: !@#........ Prompt the user to enter a number between 1 and 10. For the number of times given by the user, randomly select one of the punctuation items in the specChars variable using the random.choice() function. Print the value that is chosen.

In: Computer Science