Question

write a( much simplified) inventory management system for a video rental store super video that helps...

write a( much simplified) inventory management system for a video rental store super video that helps them manage information about their rental items (movies, games, etc). when writing the program, pay attention to variable naming and use appropriate access modifier.

  1. write an interface rentable to represent a rentable item (e.g a movie or game) with a method rentalCost that takes as a parameter the number of days of rental and returns a double value as the rental cost.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________


#include <stdio.h>
#include <string.h>
#include <math.h>

//Creating the Struct
typedef struct Pnt
{
float x;
float y;
}Point;

// Function Declarations
void setPoint(Point *ptr,float x_in,float y_in);
void printPoint(Point point,char label[]);
float getMagnitude(Point p);
Point getUnitVector(Point p);
float getSlope(Point p,Point q);
float getDistance(Point p,Point q);
Point getMidPoint(Point p,Point q);

int main()
{
   //Declaring variables
float x,y;
char label1[]={"Point#1:"};
char label2[]={"Point#2:"};

printf("%s:\n",label1);
printf("Enter x:");
scanf("%f",&x);
printf("Enter y:");
scanf("%f",&y);
Point p1;
setPoint(&p1,x,y);

printf("%s:\n",label2);
printf("Enter x:");
scanf("%f",&x);
printf("Enter y:");
scanf("%f",&y);
Point p2;
setPoint(&p2,x,y);

printPoint(p1,label1);
printPoint(p2,label2);

Point p3=getMidPoint(p1,p2);
printPoint(p3,"Mid Point of P1 and P2:");
printf("Magnitude of P1 :%.2f\n",getMagnitude(p1));
printf("Magnitude of P2 :%.2f\n",getMagnitude(p2));
Point uvp1=getUnitVector(p1);
printPoint(uvp1,"Unit Vector of P1:");
printf("Distance betwee Point#1 and Point#2 :%.2f\n",getDistance(p1,p2));
printf("Slope of Point#1 and Point#2:%.2f\n",getSlope(p1,p2));
return 0;
}


void setPoint(Point *ptr,float x_in,float y_in)
{
   ptr->x=x_in;
   ptr->y=y_in;
}
void printPoint(Point point,char label[])
{
printf("%s (%.1f,%.1f)\n",label,point.x,point.y);  
}
float getMagnitude(Point p)
{
   return sqrt(pow(p.x,2)+pow(p.y,2));
}
Point getUnitVector(Point p)
{
   float mag=getMagnitude(p);
   Point np;
   np.x=p.x/mag;
   np.y=p.y/mag;
   return np;
  
}
float getSlope(Point p,Point q)
{
   float s=(p.y-q.y)/(p.x-q.x);
   return s;
}
float getDistance(Point p,Point q)
{
   return sqrt(pow((p.x - q.x), 2) + pow((p.y - q.y), 2));
}
Point getMidPoint(Point p,Point q)
{
   Point mid;
   mid.x=(p.x+q.x)/2;
   mid.y=(p.y+q.y)/2;
   return mid;
}

_________________________________

Output:

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
write a( much simplified) inventory management system for a video rental store super video that helps...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Project For this assignment, you will write a simulation program to determine the average waiting...

    Java Project For this assignment, you will write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: delete the addfirst, addlast, and add(index) methods and instead include a single add method...

  • Needs Help with Java programming language For this assignment, you need to write a simulation program...

    Needs Help with Java programming language For this assignment, you need to write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: • delete the addfirst, addlast, and add(index) methods and...

  • Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one me...

    Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one menu item called Search. Clicking on search should prompt the user using a JOptionPane input dialog to enter a car make. The GUI should then display only cars of that make. You will need to write a second menu...

  • Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of...

    Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of physician-centered and collaborative communication. How is the caregiver’s role different in each model? How is the patient’s role different? Answer: Physical-centered communication involves the specialists taking control of the conversation. They decide on the topics of discussion and when to end the process. The patient responds to the issues raised by the caregiver and acts accordingly. On the other hand, Collaborative communication involves a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT