Questions
You built your own 3D printer and intend to make a business of printing small parts...

You built your own 3D printer and intend to make a business of printing small parts for customers. After advertising your business on campus, you receive hundreds of emails within the span of a few days - all of which are fellow students asking for quotes on printing their parts. You go through all of the STL files, and record the approximate print time, material use and cost estimates for each as follows: Order 1: Order 2: Print Time: 43 minutes Print Time: 28 minutes Colour: Red Colour: Blue Material: 1.64 feet Material: 0.91 feet Cost: 3.80 $USD Cost: 2.11 $USD Order #: Print Time: ## minutes Colour: ... Material: #### feet Cost: #.## $ USD You've recorded each customer order as shown above and intend to start completing orders next week. Before hand, you want to know the total amount of time the printing will take, the total amount of material for each colour filament that you need to have on hand and the total material costs. Seeing as there are hundreds of orders on file you don't want to do these calculations manually, so you decide to use Python instead. In this assignment, you will be completing the function definition printing(orders), which has been started for you in the code template notebook. This function takes in a list of strings orders, where each element in the list is one line from the orders file, such as: orders = ["Order 1:\tPrint Time: 43 minutes\tColour: Red\tMaterial: 1.64 feet\tCost: 3.80 $USD", "Order 2:\tPrint Time: 28 minutes \tColour: Blue \tMaterial: 0.91 feet\tCost: 2.11 $USD"] You must complete the function definition to satisfy the following requirements: 1. The program computes the following 3 values: a. printTime = the total print time for all orders, stored in a list: [hours, minutes] b. matlused = the total material used for all orders, stored in a list based on filament color: [Red_matlused, Blue_matlused, Yellow_matlused, White_matlused, Black_matlused). Since your filament provider is based out of Canada, you need to provide this measurement in metres (1 metre = 3.28 feet). c. matlCost = the total material cost in $CAD (1 $USD = 1.42 $CAD). d. profit = your estimated profit if you charge 0.25 SCAD/minute of printing and only account for the material cost in your expenses (profit = revenue - expenses). 2. The program returns print Time, matlused, matlCost, and profit as output (done for you in the code given). 3. Your name, Maced, and the date are given in comments in the first Python cell. 4. Your answers to the design questions and test plan are given in the appropriate cells in the Python notebook. 5. Your program MUST have valid Python syntax and it must run without errors. Ensure that your
# Date: In [ ]: ######################################-- printing(orders) ###################################### def printing (orders): # Modify/add to the code between here... printTime = [] matlused = [0,0,0,0,0] matlCost = 0 profit = 0 #... and here return printTime, matlused, matlcost, profit ##########---TEST YOUR CODE---#################### # Change the values of orderTest to test with different values orderTest = ["order 1:\tPrint Time: 43 minutes\tcolour: Red\tMaterial: 1.64 feet\tCost: 3.80 $USD", "Order 2: \tPrint Time: 28 minutes\tcolour: Blue\tMaterial: 0.91 feet\tCost: 2.11 $USD"] result = printing (orderTest) ############## print("printTime=" ', result[0]) print("matlused =", result[1]) print("matlCost , result[2]) print("profit=" ", result[3])

In: Computer Science

Task 1. Create class "Vehicle" with variables "company" and "year". LM 2. Create 3 derived classes:...

Task 1. Create class "Vehicle" with variables "company" and "year". LM 2. Create 3 derived classes: "Bus", "Car", and "Motorcycle". They should contain a variable storing number of seats (bus) / weight (car) / number of tires (motorcycle), constructor, destructor and a print_info function that will print all the information about the vehicle. PK 3. The constructors should take as parameters: company, year and number of seats / weight / number of tires. Inside it assign the company name and create an if / else condition that will throw an invalid_argument () exception with message "bus / car / motorcycle not produced yet" if the year is bigger than 2020, or assign the proper value. Additionally: a) for class "Bus": create if / else condition that throws an out of_range () exception with message "invalid number of seats" if that value is smaller than 8 and bigger than 70, or assign the proper value b) for class "Car": create if / else condition that throws an exception with message "car is too heavy" if that value is bigger than 3500, or assign the proper value c) for class "Motorcycle": create if / else condition that throws an exception with message "vehicle is not a motorcycle" if that value is different than 2, or assign the proper value

In: Computer Science

I need to write a MATLAB code for this question, but I couldn't figure how to...

I need to write a MATLAB code for this question, but I couldn't figure how to do it.

7. Engineers often have to convert from one unit of measurement to another; this can be tricky sometimes. You need to think through the process carefully. For example, convert 5 acres to hectares, given that an acre is 4840 square yards, a yard is 36 inches, an inch is 2.54 cm, and a hectare is 10000 m2.

In: Computer Science

Consider the following scheduling problem. There are n jobs and a single machine. Each job has...

Consider the following scheduling problem. There are n jobs and a single machine. Each job has a length ℓi and a weight wi . The weight wi represents the importance of job i.

a) Let fi be the finishing time of job i. Design a greedy algorithm to minimize the weighted sum of the completion times ∑n i=1 wifi . Your algorithm should run in time O(n log n) and output an ordering of the jobs.

b) Prove the correctness of your algorithm and analyze its running time.

Example: Suppose there are two jobs: t1 = 1, w1 = 2, t2 = 3, and w2 = 1. Doing job 1 first would give f1 = 1, f2 = 4, and a weighted sum of 2 · 1 + 1 · 4 = 6, which is optimal. Doing job 2 first would yield f1 = 4, f2 = 3, and a larger weighted sum of 2 · 4 + 1 · 3 = 11. (Hint: how does the weighted sum change if we swap two adjacent jobs?)

In: Computer Science

Consider the following variant of the Interval Scheduling problem. There are n jobs and each job...

Consider the following variant of the Interval Scheduling problem. There are n jobs and each job has a start time si and an end time fi . There is a single machine that can run at most one job at any given time. The jobs are now daily jobs. Once accepted, it must run continuously every day between its start and end times. (Note that a job can start before midnight and end after midnight.)

a) Design an algorithm that accepts as many jobs as possible. Your algorithm should run in time O(n 2 ) and output an optimal schedule (a set of intervals).

b) Prove the correctness of your algorithm and analyze its running time.

Example: Suppose there are 4 jobs, specified by (start-time, end-time) pairs: (9pm, 3am), (6pm, 6am), (3am, 1pm), and (2pm, 7pm). The optimal solution would be to pick 3 jobs (9pm, 3am), (3am, 1pm), and (2pm, 7pm), which can be scheduled without overlapping. (Hint: first enumerate an interval Ij = 1, . . . , n. How could we compute a schedule Oj with maximum size among all valid schedules that contain Ij?)

In: Computer Science

JAVA - PLEASE COMMENT CODE - THANK YOU: Implement a program that can input an expression...

JAVA - PLEASE COMMENT CODE - THANK YOU:

Implement a program that can input an expression in postfix notation and output its value.

In: Computer Science

Exercise 1: You are required to re-write the following code to catch the exception that can...

Exercise 1:

You are required to re-write the following code to catch the exception that can occur.

import java.util.Scanner;

public class ExceptionDemo

{

public static void main(String[] args)

{

Scanner scanner = new Scanner(System.in);

System.out.print("Enter an integer: ");

int number = scanner.nextInt();

// Display the result

System.out.println( "The number entered is " + number);

          }

}

In: Computer Science

Exercise 2: Try-Catch Exercise Write a Java code that does the following: Create a class MyClass...

Exercise 2:

Try-Catch Exercise

Write a Java code that does the following:

Create a class MyClass and create three methods myMethod1(), Method2() and Method3().

Invoke Method2() from Method1() and Method3() from Method2().

Write a code that can throw an exception inside myMethod3() and compile:

File file=new File("filename.txt");

Scanner sc=new Scanner(file);

You will get compilation errors now, as you are not handling a checked exception FileNotFoundException.

Declare throws over myMethod3() and myMethod2(). You will need to add throws FileNotFoundException on myMethod() as:

public void myMethod3() throws FileNotFoundException

{

File file=new File("filename.txt");

Scanner sc=new Scanner(file);

}

Handle the exception in myMethod1() by enclosing the code that can throw exception using a try-catch block:

public void myMethod1()

{

try{

myMethod2();

}

catch(FileNotFoundException e)

{

e.printStackTrace();

}

}

In: Computer Science

The following variables are declared as follow: int Var1 = 9, Var2 = 2, Var3 =...

The following variables are declared as follow:

int Var1 = 9, Var2 = 2, Var3 = 0;

What will the output of the following statements be?

Var3 = Va1 / Var2;

Var2 = Var2 / Var1;

out.print(Var3);
out.print(Var2);
int Var1 = 19, Var2 = 12,

oy.print(Var1 % Var2);
oy.print(Var1 % 3.0);
3. Var1 += 5;

System.oy.print(Var1);

In: Computer Science

whats the purpose of data warehouse design ? how is dimensional data models implemented in a...

whats the purpose of data warehouse design ?

how is dimensional data models implemented in a database covering relation implementation and multidemensional implementation.

In: Computer Science

List the product name and description of every product with a list price higher than $500...

List the product name and description of every product with a list price higher than $500 that has either the word “humbuck” or “fret” in the description. Use a regular expression to do this.


my guitar shop

In: Computer Science

List five types of files (e.g., JS) that have special meaning in web servers/web pages, and...

List five types of files (e.g., JS) that have special meaning in web servers/web pages, and explain briefly the role of each of the file types.

explain the hierarchy of network protocols used by web browsers/web servers, starting from the low level (IP) up to the high level (HTTP), with a brief explanation of each one.

In: Computer Science

JAVA Program The program below the text reads in the pet type …dog, cat or other...

JAVA Program

The program below the text reads in the pet type …dog, cat or other (only the words dog, cat, other) and the appointment amount. It is supplied as a beginning code to the assignment:

_______________________________________________________________
pet_lab package; 
import javax.swing.JOptionPane; 
public class pet_lab 
{ 

        public static void main (String [] args) 
        { 
                String pet, temp; 
                double payment; 
                pet = JOptionPane.showInputDialog (null, 
                 "Enter the pet type", "", JOptionPane.QUESTION_MESSAGE); 
                temp = JOptionPane.showInputDialog (null, 
                "Enter the payment for the appointment", "", JOptionPane.QUESTION_MESSAGE); 
            payment = Double.parseDouble (temp); 
            System.exit (0); 
        } 
}
_______________________________________________________________

You are to make the following changes:

  • Add a loop that reads data until the user wishes to stop
  • Count and print the number of dogs, cats and other pets
  • Calculate and print the total paid for dogs, cats and other pets
  • Calculate and print the total payment of all pets seen
  • Print which pet is seen the most, dogs, cats, or other

Please paste both the java code, a screenshot of the same code, and a screenshot/pasting of the final answer. Using this to check my Java data. Thanks!

In: Computer Science

Hi ERP experts! I am looking for ERP failure implementation cases. Specifically, I need suggestions of...

Hi ERP experts! I am looking for ERP failure implementation cases. Specifically, I need suggestions of cases, so I can summarize key factors influencing the success of the Sales & Marketing ERP module implementation.

In: Computer Science

Analysis and Discussion about if, if else, else if statement and Switch C programming write on...

Analysis and Discussion about if, if else, else if statement and Switch C programming write on your computer font

In: Computer Science