Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Suppose a particle has a position function given by x(t) = t 3 + 2, where x i

ID: 2858939 • Letter: 1

Question

1) Suppose a particle has a position function given by x(t) = t 3 + 2, where x is distance in meters and t is time in seconds. Find the average speed of the particle between t = 0 and t = 2 and between t = 1 and t = 3. Plot a graph of the lines connecting the points (0, x(0)), (2, x(2)) and the points (1, x(1)), (3, x(3)).

2) Using the function f(x) = x 2 x compute the average rate of change of f(x) with respect to x on the intervals (0, 1), (0.5, 1), (0.5, 1), (0.875, 1). Write a function g(t) = f(x)f(t) xt , what does this function measure for any point t?

Note: Please present step by step how to solve these problems. Thanks in advance.

Explanation / Answer

WeekDayCalculation.java

import java.util.Scanner;
public class WeekdayCalculation {
public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      // Prompt to user to enter the year
      System.out.print("Enter year: ( e.g., 2008) ");
      int year = input.nextInt();

      // Prompt to user to enter the month
      System.out.print("Enter month: 1-12 : ");
      int month = input.nextInt();

      // Prompt to user to enter the day of the month
      System.out.print("Enter the day of the month: 1-31 : ");
      int dayOfMonth = input.nextInt();
  
      // Calculate m value
      switch (month) {
         case 1 : month = 13;
                  year--;       
                  break;
         case 2 : month = 14;
                  year--;
                  break;
         default : break;
      }

      // Calculate the century j value & year in century k value
      int century = year / 100;
      int yearInCentury = year % 100;
      
      // Init the variables with simple name in the formula
      int q = dayOfMonth;
      int m = month;
      int j = century;
      int k = yearInCentury;
      String dayOfWeek = "";
  
      // Calculate the day of week
      int h = (q + 26 * (m + 1) / 10 + k + k / 4 + j / 4 + 5 * j) % 7;
      switch (h) {
      case 0 : dayOfWeek = "saturday";
               break;
      case 1 : dayOfWeek = "sunday";
               break;
      case 2 : dayOfWeek = "monday";
               break;
      case 3 : dayOfWeek = "tuesday";
               break;
      case 4 : dayOfWeek = "wednesday";
               break;
      case 5 : dayOfWeek = "thursday";
               break;
      case 6 : dayOfWeek = "friday";
               break;
      default : System.out.println("The value of day is not in 0-6, please check");
               break;    
      }
  
      System.out.println("Day of the week is " + dayOfWeek);
      
      
}
}


sample output

Enter year: ( e.g., 2008) 2015                                                                                                                              
Enter month: 1-12 : 3                                                                                                                                       
Enter the day of the month: 1-31 : 4                                                                                                                        
Day of the week is wednesday                                                                                                                                


InsideCircle.java

import java.util.Scanner;

public class InsideCircle {
   public static void main(String[] args){
       Scanner input = new Scanner(System.in);
       // Prompt for user to enter a point
       System.out.print("Enter a point with two coordinates: ");
       double x = input.nextDouble();
       double y = input.nextDouble();
     
       // Calculate the distance from the point to the center of circle
       double distance = Math.pow(Math.pow(x,2) + Math.pow(y, 2), 0.5);
     
       // Judge and tell if the point is in the circle
       System.out.println((distance < 10) ? "Point (" + x + "," + y + ") is in the circle" : "Point (" + x + "," + y + ") is not in the circle" );
   }
}

sample output

Enter a point with two coordinates: 4 5                                                                                                                     
Point (4.0,5.0) is in the circle