Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to create a java code for a Wish List Management and those are the requierements: Users can create and have 3 different wish

I have to create a java code for a Wish List Management and those are the requierements:

Users can create and have 3 different wish lists which can have books moved to from the primary list.

DESCRIPTION: There will be a section called wish lists, in which the user can create up to 3 new lists and give them different names. Each list can show the items that have been added to the list and each item can be added to the cart. Items can be added to the different lists from the item details page. Items can be removed from any list in this section. Items can be transferred from one wish list to another.

I have something like this but I need java code

import React, { useState, useEffect } from "react"; import API from "../../utils/API"; import { Container, Card, Row, Col, Dropdown, DropdownButton, Button } from "react-bootstrap"; import EditText from "../EditText/EditText";

function WishList(props) { const [items, setItems] = useState([])

useEffect(() => { API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) .catch(err => console.log(err)); }, [])

function handleMoveBook(current, desired, book){ console.log(current, desired); if(current === desired){ return; } API.removeBookFromWishlist(props.userEmail, current, book).then(res => { API.addBookToWishList(props.userEmail, desired, book).then(res =>{ API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) .catch(err => console.log(err)); }) .catch(err =>{ console.log(err); }) }) .catch(err =>{ console.log(err); }) }

function handleNameChange(wishListId, name) { API.renameWishlist(props.userEmail, wishListId, name).then(res =>{ API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) }) .catch(err =>{ console.log(err); }) } function handleNewWishList(id){ API.addWishList(props.userEmail, id, []).then(res =>{ API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) }) .catch(err =>{ console.log(err); }) }

function handleWishListDelete(wishListId){ API.removeWishlist(props.userEmail, wishListId).then(res =>{ API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) }) .catch(err =>{ console.log(err); }) }

function handleAddToShoppingCart(book, wishListId){ API.addToCart(props.userEmail, book).then(res =>{ API.removeWishlist(props.userEmail, wishListId).then(res =>{ API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) }) }) .catch(err =>{ console.log(err); }) }

function handleBookDelete(wishListId, book){ API.removeBookFromWishlist(props.userEmail, wishListId, book).then(res => { API.getWishLists({ email: props.userEmail }).then(res => { setItems(res.data); }) .catch(err => console.log(err)); }) .catch(err =>{ console.log(err); }) }

return (

Wishlists

{items.length Add New Wishlist : null} {items.map((item, index) => ( handleNameChange(item.wishListId, text)}> handleWishListDelete(item.wishListId)}>Delete {item.books.map((book, index) => ( {book.title} {book.description} {items.map((otherthing, index) =>( {handleMoveBook(item.wishListId, index + 1, book)}}>{otherthing.name} ))} handleAddToShoppingCart(book, item.wishListId)}>Shopping Cart handleBookDelete(item.wishListId, book)}>Delete ))} ))} ) }

export default WishList;image text in transcribed

users user_id int shipping cc_info password varchar ship_id int cc_id fname varchar user_id int user_id Iname varchar ship_address varchar Cc_num email varchar ship_city varchar cw_num nickname varchar ship_state varchar expiration date home_address varchar ship_zip int home_city varchar home_state varchar wish_list home_zip list_id Cc_id user_id ship_id book_id book shopping_cart book_id int user_id title varchar book_id price int price genre varchar quantity author varchar total rating int release_date date users user_id int shipping cc_info password varchar ship_id int cc_id fname varchar user_id int user_id Iname varchar ship_address varchar Cc_num email varchar ship_city varchar cw_num nickname varchar ship_state varchar expiration date home_address varchar ship_zip int home_city varchar home_state varchar wish_list home_zip list_id Cc_id user_id ship_id book_id book shopping_cart book_id int user_id title varchar book_id price int price genre varchar quantity author varchar total rating int release_date date

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899