asked 10.2k views
4 votes
Write an oops code and design in visual basic for a organic Market

The app will display a menu User will be able to select items from the menu, Items are added into cart ,Amount of total items is calculated and reflected to checkout, User will be able to subscribe frequent buyer service, for every purchase made user gets reward points which can be used in future purchases, user chooses a mode of payment

asked
User OnIIcE
by
7.4k points

1 Answer

1 vote

Final answer:

The question involves creating an OOP code in Visual Basic for an organic market application that handles item selection, cart management, checkout, reward points, and payment options. Pseudocode examples help illustrate how to structure the various classes like User, CartItem, Cart, and CheckoutSystem to implement the required functionality.

Step-by-step explanation:

The student has asked for an object-oriented programming (OOP) code in Visual Basic for an organic market application. This app would allow users to select items from a menu, add them to a cart, and proceed to checkout where the total amount is calculated. Additionally, users can subscribe to a frequent buyer service, earning them reward points with each purchase. These points can then be used for future purchases. Moreover, users have the option to choose their preferred mode of payment.

OOP Concepts in Visual Basic

In order to accomplish this task, several OOP concepts such as classes, objects, inheritance, and encapsulation must be implemented. For instance, a class named CartItem can represent each item in the cart with properties for name, price, and quantity. A Cart class might manage an array of CartItem objects, and a User class can handle user information including subscription status and reward points. The Checkout process could involve methods to calculate the total cost and apply reward points if necessary.

Example Pseudo Code

The following pseudo code illustrates a simple design for the described system:


  1. Define classes for User, CartItem, Cart, and CheckoutSystem.

  2. Create a User object when someone registers or logs in.

  3. Allow User to select CartItems and add them to their Cart.

  4. At checkout, the Cart calculates the total and passes it to CheckoutSystem.

  5. User can apply reward points and select a payment method in CheckoutSystem.

  6. If the User is subscribed to the frequent buyer service, update their reward points after purchase.

Note: This example uses pseudocode and is not actual Visual Basic code, but it demonstrates how the app's structure might be organized using OOP principles.

answered
User Brentonk
by
7.8k points