Assignment Chef icon Assignment Chef

Browse assignments

Assignment catalog

33,401 assignments available

[SOLVED] Cs2102 – your company, apasaja pte ltd, has been commissioned to design and implement a database application to record information about car rental operation for the pinjamobil pte ltd. the application stores and manages historical information about the customers and cars.

The application also stores and manages information about the cars. A specific car is identified by their license plate with the color of the car recorded. The current scheme for license plate starts with letter S followed by two letters, four digits, and the final checksum letter (see: Wikipedia). The brand and the model of each car are also recorded, which we call as the make of the car. The application also tracks all passenger information of a car that are being rented. If a car is not currently being rented, there should be no passenger. For simplicity, the passenger will ride for the entire duration of the rented car. So if a car is being rented in the interval [s, e], then any passenger of this car will ride in the car for the entire interval [s, e]. References Page 2 1. (3 points) Creating and Populating Tables with Constraints (a) (3 points) DDL Write the SQL Data Definition Language (DDL) code, CREATE TABLE with integrity constraints, to create the necessary table(s) for storing the data required by the application. Ensure all necessary data can be accommodated, and avoid catering for unnecessary, inconsistent, or unnecessarily redundant data. Propagate updates to maintain referential integrity. Only propagate deletions where it make sense. (b) (0 points) DML Other random data can be found from Mockaroo. There is a car make in Mockaroo but it is closer to brand in our terminology. Although technically the model year matters for capacity, we will simplify the problem by ignoring this information. Use this data to write SQL Data Manipulation Language (DML) code to populate the database. Submission • Canvas Submission: “Assignments > Questions 1” (one file per project group) • Files – SQL DDL: schema.sql Ensure that schema.sql can be executed on a fresh database. – SQL DML: data.sql Page 3

$25.00 View

[SOLVED] Cs150 – lab 27/28 (counts as two labs)

Create classes CatRecord, DogRecord and BirdRecord that inherit from (extend) the PetRecord class located on Canvas.Add an integer variable wingspan to BirdRecord, and a Boolean variable hasLongHair to CatRecord and DogRecord. Create appropriate setter and getter methods for each. Also, create constructors that can set all of the values for a cat, dog or bird by setting the values specific to that animal.Create a main to test out your work and show that your new classes work correctly. Do NOT modify the PetRecord class.

$25.00 View

[SOLVED] Cs150 – labs 15 and 16 (work in pairs)

You must create an algorithm (flowchart or written out) BEFORE coding this lab (revising later is OK). You will receive credit for lab 15 for the algorithm, and for lab 16 for the working program which must match your algorithm. Create a program that simulates a vending machine – your program will ask the user to enter a price for an item first, then enter the amount of money deposited. Your program should print the change that is given to the user to a text file, as a number of quarters, dimes, nickels, and pennies. Format the file as in the example given. Change should be given using the smallest number of coins possible (change higher than 1 dollar can be given in quarters). If the user will receive no change, say “no change” instead of 0 quarters, 0 dimes, 0 nickels and 0 pennies. If the user enters less money than the price of the item then give an error message on the screen stating “not enough money inserted” and print nothing to the file. After each transaction, whether enough money or not, ask the user if they have another transaction (enter capital or lowercase Y or N), and repeat if so. Note: You can assume that the user will type the price as a decimal number without a dollar sign. Rounding issues within one penny are OK. Sample inputs/outputs: Enter price of item: $1.25 Enter amount of money inserted: $1.90 Change: Quarters: 2 Dimes: 1 Nickels: 1 Pennies: 0 Do you have another entry?: Y Enter price of item: $1.25 Enter amount of money inserted: $2.60 Change: Quarters: 5 Dimes: 1 Nickels: 0 Pennies: 0 Do you have another entry?: y Enter price of item: $2.00 Enter amount of money inserted: $2.00 No Change Do you have another entry?: Y Enter price of item: $1.25 Enter amount of money inserted: $1.00 Error: Not enough money inserted. Do you have another entry?: N File Contents: Price: $ 1.25 Money inserted: $ 1.90 Change: Quarters: 2 Dimes: 1 Nickels: 1 Pennies: 0 ******************** Price: $ 1.25 Money inserted: $ 2.60 Change: Quarters: 5 Dimes: 1 Nickels: 0 Pennies: 0 ******************** Price: $ 2.00 Money inserted: $ 2.00 No Change ********************

$25.00 View

[SOLVED] Cs150 – lab 26

Modify the supplied bubble sort program to bubble sort in ascending order instead of descending order. Do NOT modify main, only the bSort function itself. (Code provided in the Lab 26 repl) HINT: You need to make only one change to the code. If you need to get the original code back again (the code that was supplied with the repl) then copy it from the Bubble Sort Example Code on Canvas. Test Case 1: (enter 10 numbers of your choice, including at least one decimal, at least 1 negative, and at least 1 duplicate, and show that it sorts correctly in ascending order).

$25.00 View

[SOLVED] Cs150 – if/else if/else (labs 4/5 – work in pairs)

• Draw a flowchart for the following program, then code it (making changes later is fine). • Include a through list of test cases with your flowchart that test all branches of it. • HIGHLY ADVISED TO TEST LAB 4 ON PAPER/FLOWCHART BEFORE CONTINUING TO LAB 5, AND HAVE IT CHECKED IF IN THE “LIVE” SESSION AT THE TIME. • Create a program that asks the user to enter an integer. • If it is even: • Print whether or not it is divisible by both 5 and 3 (i.e. “Is div. by 5&3” or “Isn’t div. by 5&3). • If it is odd: • Print whether or not it is negative • Whether it is even or odd print whether it is between -100 and 100 inclusive (-100 and 100 are in the range). • Note: Zero is even and is not negative. • Your program must correspond to your flowchart (Lab 5) • You will receive credit for Lab 4 with a correct flowchart, and for Lab 5 with a working program that corresponds to your flowchart.

$25.00 View

[SOLVED] Cs150 – lab 25

Create an array of 10 integers containing the following values (in this order): 12, -7, 3, 17, 42, 6, 18, -15, 0, 1. Create a function called seqSearch that takes a const array and an integer key as parameters, and returns the array slot number that the key was found in. If the key was not found, the function should return -1. Main should use the function to have the user enter a number and print the array slot it was found in, or that it was not found. Test Cases: Test Case 1: Enter a number to search for: 17 was found in array slot 3. Test Case 2: Enter a number to search for: 12 was found in array slot 0. Test Case 3: Enter a number to search for: 1 was found in array slot 9. Test Case 4: Enter a number to search for: 40 was not found. ****Note: Should NOT say 40 was found in array slot -1!****

$25.00 View

[SOLVED] Cs150 – lab 24

Modify Lab 23 to split it into 3 files, main.cpp, circle.cpp and circle.h. circle.h must have include guards. The program should still do the same thing it does in Lab 23. Lab 23: Modify Lab 22 so that the radius variable in class circle is private. Write a setter and getter function for radius, as well as a default constructor that initializes it to 0 and a constructor that takes one parameter for radius. If radius is given as a negative in a call to the setter or the constructor set it to 0 instead. Lab 22: Create a program that defines a class called circle. Circle should have a member variable called radius that is used to store the radius of the circle. Circle should also have a member function called calcArea that calculates the area of the circle using the formula area = pi*r^2. Area should NOT be stored in a member variable of circle to avoid stale data. Use a global constant for PI and set it to 3.14159. In main, instantiate (declare/create) and use circle objects as needed to prove that all of your functions, including both constructors, work properly (construct a test case for your class in main).

$25.00 View

[SOLVED] Cs150 – lab 22

Create a program that defines a class called circle. Circle should have a member variable called radius that is used to store the radius of the circle. Circle should also have a member method called calcArea that calculates the area of the circle using the formula area = pi*r^2. Area should NOT be stored in a member variable of circle to avoid stale data. Use the value 3.14 for PI. For now, build everything in one file (main.cpp), make radius public and access radius directly using the dot operator. Do not worry about input validation for now. In main instantiate two objects of class circle and have the user enter a radius for each. Store the radii in the appropriate objects’ member variables, then print the radius and area of each circle using the member variable and function.

$25.00 View

[SOLVED] Cs150 – lab 23

Modify Lab 22 so that the radius variable in class circle is private. Write a setter and getter function for radius, as well as a default constructor that initializes it to 0 and a constructor that takes one parameter for radius. If radius is given as a negative in a call to the setter or the constructor set it to 0 instead. Create a program that defines a class called circle. Circle should have a member variable called radius that is used to store the radius of the circle. Circle should also have a member function called calcArea that calculates the area of the circle using the formula area = pi*r^2. Area should NOT be stored in a member variable of circle to avoid stale data. Use a global constant for PI and set it to 3.14159. In main, instantiate (declare/create) and use circle objects as needed to prove that all of your functions, including both constructors, work properly (construct a test case for your class in main). Show a test run or runs of your own design proving that everything works.

$25.00 View

[SOLVED] Cs150 – lab 21

Create a program that defines a struct for a student. The following data should be part of the struct: studentID (int), gpa(double), fullName(string), units(int). Instantiate (create) two students and have the user type in information for each, then print both back to the screen afterwards. Input validation: studentID should be positive and have 4 digits (no leading zeros), GPA should be between 0 and 4 (inclusive), units should be positive. Have any invalid inputs reentered. Test your work thoroughly, including testing input validation and different values in each of the two student structs.

$25.00 View

[SOLVED] Cs150 – lab 20

Create a function that accepts four double values as parameters. These four double values should NOT modify the related values in main. The function should return the minimum of the four values, maximum of the four values, and average of the four values. Hint: Remember pass-by-reference to return multiple values – your function should have seven parameters and a return type of void. Pass-byreference should be used only with variables that it is necessary for. Test Cases: Test Case 1: Please enter four numbers: Number 1: Number 2: Number 3: Number 4: Minimum is -7.8 Maximum is 4.6 Average is -0.3 Test Case 2: Please enter four numbers: Number 1: Number 2: Number 3: Number 4: Minimum is -7.8 Maximum is 4.6 Average is -0.3 Test Case 3: Please enter four numbers: Number 1: Number 2: Number 3: Number 4: Minimum is 5.3 Maximum is 5.3 Average is 5.3

$25.00 View

[SOLVED] Cs150 – lab 19

COPY your completed code from Lab 18 into your lab 19 repl (be sure Lab 18 is working correctly first). After you have copied it, modify the code in the Lab 19 repl so that instead of closing we ask the user if they want more trees after drawing their request, and if they enter “Y” or ‘y’ repeat the process (enter number and height, then draw). After drawing each “batch” of trees also tell the user how many trees have been drawn overall. Use a static variable in drawTrees to track this information. IMPORTANT: Complete this lab in the Lab 19 repl only – do NOT overwrite or modify Lab 18 in the Lab 18 repl! Write a function called treeTop that prints the top of a tree. It should take no parameters and return void. Write a second function called treeTrunk that prints the trunk of a tree. It should take one integer as a parameter for height (how many lines tall the trunk is), and also have a return type of void. Finally, create a function called drawTrees that takes two integer parameters, one for height and one for the number of trees to draw. drawTrees should use treeTop and treeTrunk. Have the user enter the height of the trees (same for all) and number of trees to draw. Remember that to draw a backslash you need two backslashes. Test case: Enter tree height: Enter number of trees: ^ / / /____ | | | | ^ / / /____ | | | | ^ / / /____ | | | | There are currently 3 trees in the forest. Do you want more trees (Y/N) ?: Enter tree height: Enter number of trees: ^ / / /____ | | | | | | | | | | There are currently 4 trees in the forest. Do you want more trees (Y/N) ?: Enter tree height: Enter number of trees: ^ / / /____ | | ^ / / /____ | | ^ / / /____ | | There are currently 7 trees in the forest. Do you want more trees (Y/N) ?:

$25.00 View

[SOLVED] Cs150 – lab 14

Write a program that asks the user to enter the number of vanilla, strawberry, and chocolate ice cream cones sold by an ice cream shop each day for a week (total of 21 inputs). Store this data into a 2-dimensional array. Display the data from the array to the screen in a clear, readable table (hint: Try using setw to line up the table). Your table should also display the total cones sold each day, the total cones of each flavor sold for the week, and the total cones overall sold for the week.Test Case 1: Test with inputs of your choice.

$25.00 View

[SOLVED] Cs150 – lab 13

Create an array of 1000 double datatype elements, store 7.5 times the array slot number as the value in each array slot. After creating and filling the entire array, ask the user to enter an integer between 0 and 999 – print the value of that element of the array (if the user entered 121 you would print the contents of array slot 121 which would be 907.5). You must use a named constant for the array size of 1000. Example Output: Test Case 1: Enter an array slot number: The value in array slot 40 is 300 Test Case 2: Enter an array slot number: The value in array slot 0 is 0 Test Case 3: Enter an array slot number: The value in array slot 999 is 7492.5 Test Case 4: Enter an array slot number: Value out of range. Test Case 5: Enter an array slot number: Value out of range.

$25.00 View

[SOLVED] Cs150 – lab 11

Create a file named sentence.txt and write a sentence the user enters to it using ofstream. Test case 1: Enter a sentence: File Contents: sentence.txt contains the user’s sentence after the program is run.

$25.00 View

[SOLVED] Cs150 – lab 10

Print the multiplication table from 1-9 similarly to what is shown below, including the legend on the top and sides. Calculate the values and use nested loops to complete this lab. Your table should line up nicely (remember setw!) Think about the three types of loops we have learned (while, do-while and for) and choose the most appropriate type for this problem. You should test your program and make sure it works before asking me to check it off! The examples below are test cases. Your code should work properly with all test cases listed, as well as with other inputs. Please test your code with all test cases included with each lab, and have these test cases already run and on screen when you call me over to check you off.Example Output:Test Case 1: 1 2 3 4 5 6 7 8 9 —————————————————– 1 | 1 2 3 4 5 6 7 8 9 2 | 2 4 6 8 10 12 14 16 18 3 | 3 6 9 12 15 18 21 24 27 4 | 4 8 12 16 20 24 28 32 36 5 | 5 10 15 20 25 30 35 40 45 6 | 6 12 18 24 30 36 42 48 54 7 | 7 14 21 28 35 42 49 56 63 8 | 8 16 24 32 40 48 56 64 72 9 | 9 18 27 36 45 54 63 72 81

$25.00 View

[SOLVED] Cs150 – lab 9

Ask the user to enter an integer (positive or negative does not matter). Repeat the integer given by the user and tell them whether it is even or odd. After the user enters the first integer, and after each subsequent integer entered, ask the user if they wish to enter another integer. If they answer ‘Y’ or ‘y’ then repeat, if they answer ‘N’ , ‘n’ , or any other character then tell them how many odd numbers they entered and how many even numbers they entered. Note that the user should always enter at least one integer – only ask them if they have another after the first entry. Think about the three types of loops we have learned (while, do-while and for) and choose the most appropriate type for this problem. You should test your program and make sure it works before asking me to check it off! The examples below are test cases. Your code should work properly with all test cases listed, as well as with other inputs. Please test your code with all test cases included with each lab, and have these test cases already run and on screen when you call me over to check you off.Example Output: Test Case 1: Enter an integer: 7 is odd. Do you have another integer to enter (Y/N)?: Y Enter an integer: -5 is odd. Do you have another integer to enter (Y/N)?: y Enter an integer: 16 is even. Do you have another integer to enter (Y/N)?: N Odd numbers: 2 Even numbers: 1

$25.00 View