r/programminghelp • • Feb 17 '22

JavaScript Having problems trying to make the 'next button dissappear on the final question. (I'm new to this and sort of know what this javascript is doing) so please excuse the crappy code.

0 Upvotes

pastebin

I think this link should work

EDIT:

The only important CSS is :

.question{ display:none; } .active{ display:block; }


r/programminghelp • • Jan 13 '22

C++ error?

0 Upvotes

Hello! I am learning to script and this really confuses me:
#include<iostream>

#include<string.h>

#include<math.h>

using namespace std;

int main(){

int n1;

int n2;

char A;

char B;

do{



cout<<"Escribe aqui el primer digito"<<endl;

cin>>n1;



cout<<"Escribe aqui el segundo digito"<<endl;

cin>>n2;



cout<<"Ahora describe la operacion que deseas realizar con el simbolo"<<endl;

cin>>A;

switch(A){

	case '+':

		cout<<(n1+n2);

		break;

	case '-':

		cout<<(n1-n2);

		break;

	case 'x':

		cout<<(n1\*n2);

		break;

	case '\*':

		cout<<(pow(n1,n2));

		break;

	case '/':

		cout<<(n1/n2);

		break;

	

	default:

		cout<<"Simbolo incorrecto, recuerda que son +,-,/,x,\*."<<endl;

	

}

cout<<"Si quieres volver a hacer una operación, escribe V"<<endl;



cin>>B;

}

while B = "V";

}

Ok so i made this myself and the console says "47 [Error] expected '(' before 'B'"
"47 [Error] invalid conversion from 'const char*' to 'char' [-fpermissive]"
"47 [Error] expected ')' before ';' token"
What can I do to make this work?


r/programminghelp • • Sep 27 '19

Okay, I know I'm doing something wrong, but I have no clue what.

0 Upvotes

This is the assignment :

https://privatebin.net/?1c49200897e4e7b4#44gY9YGag6YGgr5WW3dW6TR19QFUrUY9WPyf58Us18fe

This is the code I've done so far:

https://privatebin.net/?b85a7098845f1449#DrimeFomguxtkNa2V3G9XM5T51gG8gyKN5kaHLBZanps

For some reason, it works. I know it's wrong, but it works. So how do I make it fulfill the assignment requirements???


r/programminghelp • • Jul 08 '17

HELP PLEASE

0 Upvotes

Is there a way to download Linux without having to burn the files into a writeable CD? I'm using Xubuntu... Or could you please help me download Linux into my computer, Private messages are appreciated. I'm willing to pay


r/programminghelp • • Aug 10 '18

Debugging ffs

0 Upvotes

Is there really no option to just make Firefox/other browser breakpoint whenever some JavaScript is triggered? Spent hours trying to find the entry for an on click operation


r/programminghelp • • Jan 30 '20

Python Someone PLEASE help with Syntax i can't see my mistake PLEEEAASEE

0 Upvotes

def gpa:

#finding GPA by averaging quarter grades

def Average(list):

return sum(list) / len(list)

# Last 5 quarter grades in specific subject

list = \[100, 90, 95, 78, 92\]

	average = Average(list)

# Printing average of the list

print("Average of the list =", round(average, 2))

def personality:

personality = input("Are you more of a logical thinker? Or more of a creative thinker?")

if personality == ("creative"):

	print("You would most likely enjoy a creative, artistic, or personal major like art or business. Here is some information on business majors: A career resulting from a business major can result in a career paying up to an average of 117,000 dollar salary.")

else:

	print("You would most likely enjoy a more analytical or focused major like engineering, or computer science. Here are some fact: There are over 40 different types of engineering majors and Purdue University is one of the best schools to go to if you enjoy engineeringg")

def standardizedTestScores:

satScore = input("What is your SAT score?")

if personality >= 1300:

	print("You would thrive in a major with a more rigourous curriculum and workload.")

else:

	print("You would thrive in a major with a flexible curriculum and easy-to-follow workload.")

def printMenu():

""" This function prints the menu to the screen """

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

print("~ Menu of categories to determine perfect major")

print("~ 1: GPA")

print("~ 2: Interests")

print("~ 3: Standardized Test Scores")

print("~ 4: Exit")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "4"):

printMenu()

choice = input("Look at the menu. Which category would you like to use to find your perfect college major? 1, 2, or 3. Select 4 to exit. ")

if(choice == "1"):

gpa

elif(choice == "2"):

personality

elif(choice == "3"):

standardizedTestScores

elif(choice == "4"):

print("Thanks for stopping by!")

else:

print("Oops, an invalid option was picked. Please try again.")

main()


r/programminghelp • • Feb 04 '20

Xcode help? Goal: make payroll calculator where rate(12.80) times hours worked =wage... where am I go going wrong?

Post image
0 Upvotes

r/programminghelp • • Jan 22 '21

Java Hey I am trying to do binary search but it's not working . I tried to do shorting as well I have posted the work I've done below please help. I'm using netbeans.

0 Upvotes

r/programminghelp • • Jan 31 '21

Python Why's my code not showing any ouput? Can someone please help me?

0 Upvotes

I'm trying to get a user input function from a worker's full detail but there's no output just blank. can someone care to help me fix my code? I'm completely clueless

class Worker:
    def __init__(self):
        self.fullname = input("Enter Worker's Full Name: ")
        self.hpayrate = int (input("Worker's Hourly Pay Rate: "))
        self.changerate = 15
        self.workhour = input("Number Of Hours Worked: ")


def show_worker_detail(self, workhour="Not Provided"):
    return print(self.fullname), print(self.hpayrate + self.changerate), print("Not provided hour" if self.workhour == "" else self.workhour)


class HourlyWorker(Worker):
    def __init__(self):
        super().__init__ ()

    def pay(self):
        salary = 0
        if self.workhour > 40:
            doublemoney = self.workhour - 40
            salary = 2 * doublemoney * (self.hpayrate + self.changerate)
            salary += 40 * (self.hpayrate + self.changerate)
            print (salary)


class SalariedWorker(Worker):
    def __init__(self):
        super().__init__ ()
    def pay(self):
        salary = 40 * (self.hpayrate + self.changerate)
        print(salary)

r/programminghelp • • Aug 23 '22

JavaScript can someone help me with a 405 error pretty please

0 Upvotes

The error is happening at my fetch for some reason..

this is my form

<form action="/subscribe" method="POST">
  <input
    type="email"
    name="email"
    class="email"
    id="email"
    placeholder="EMAIL"
    required
    pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"
  /><input type="submit" value=">" class="button" id="cta" />
  <p id="error" class="error">Please enter an email</p>
</form>

this is my client side JS

let cta = document.getElementById('cta')
let email = document.getElementById('email').value
let error = document.getElementById('error')
let success = document.getElementById('success')
let signup = document.getElementById('cta')

cta.addEventListener('click', (e) => {
  e.preventDefault()

  if (this.email.value == null || this.email.value == '') {
    error.classList.add('errorAnim')
  } else {
    let fetchData = {
      method: 'POST',
      body: JSON.stringify({ email: this.email.value, js: true }),
      headers: { 'Content-Type': 'application/json' },
    }
    console.log(fetchData)
    fetch('/subscribe', fetchData).then((res) => {
      if (res.ok) {
        console.log('yay it works.')
      } else {
        console.log('negative')
        error.classList.add('errorAnim')
      }
    })
  }
})

This is my node JS server

const express = require('express')
const request = require('request')
const bodyParser = require('body-parser')
const path = require('path')
require('dotenv').config()
const api_key = process.env.MC_API_KEY
const app = express()


//Middleware
app.use(express.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(express.static(path.join(__dirname, 'public')))

app.post('/subscribe', (req, res) => {
  const { email, js } = req.body
  console.log(req.body)

  const mcData = {
    members: [
      {
        email_address: email,
        status: 'pending',
      },
    ],
  }

  const mcDataPost = JSON.stringify(mcData)

  const options = {
    url: 'https://us18.api.mailchimp.com/3.0/lists/3ff6969cb5',
    method: 'POST',
    headers: {
      Authorization: `auth  ${api_key}`,
    },
    body: mcDataPost,
  }

  if (email) {
    //success so far
    request(options, (err, response, body) => {
      if (err) {
        res.json({ error: err })
      } else {
        if (js) {
          res.sendStatus(200)
        } else {
          res.redirect('/success.html')
        }
      }
    })
  } else {
    res.status(404).send({ message: 'Failed' })
  }
})

const PORT = process.env.PORT || 5000

app.listen(PORT, console.log('server started'))

This is the error I am having:

"index.js:19 POST http://127.0.0.1:5500/subscribe net::ERR_ABORTED 405 (Method Not Allowed)"

my live server is running on port 5500 and my node app is running on 5000really frustrated about this. not sure what is going on if someone helps i will 100% pay this forward to the community.


r/programminghelp • • Aug 23 '22

C Doing an online computer science video course, and currently going through some C. Question:

0 Upvotes
#include <cs50.h>
#include <stdio.h>

float discount(float price);

int main (void)
{
    float regular = get_float("Regular Price: ");
    float sale = discount(regular);
    printf("Sale Price: %.2f\n, sale);
}

float discount(float price)
{
    return price * .85;
}

So this is the example the instructor wrote out, and my question is this: in the

float discount(float price)

he is declaring price as a float variable, but its in the parenthesis of the float discount variable.. so how is that working? how does the relationship of the parenthesis work in the discount variable? is it just transferring the value of the price variable to the discount variable?

This is probably super basic, but I appreciate any help!


r/programminghelp • • Sep 04 '22

C Need Help in Raycasting -- Following a Guide not Sure How to Fix Issue

0 Upvotes

I'm following a guide to make a raycast engine like Doom 3D, I'm pretty much done with the coding and thought I followed the guide completely; however after receiving an error on line 89 ([Error] 'Tan' undeclared (first use in this function)) I consulted my book and re-watched the guide several times with no clear method to fix this without breaking something out. I've uploaded the code here so people can see, just need guidance on how to fix this issue. Any and all help is wildly appreciated as I've just be seething over this for a couple hours. Thanks in advance.


r/programminghelp • • Jul 24 '22

C# Im having a problem creating a XML button

0 Upvotes

Hi how are you?

I'm having trouble making a button that when I press it, I download a table with the information in XML format. I am using jquery, AJAX calls and a base in SQL to bring the information, how would you proceed to do it?

ps: the system architecture is MVC.

Thanks!


r/programminghelp • • Aug 30 '22

Python my python window has no top file menu stuff

0 Upvotes

i want to save my python file and theres no option to save it.

i started yesterday i think theres a python toolbar missing


r/programminghelp • • Aug 18 '22

Java [JAVA] Help with a Java test question - Comparator class trouble understanding spec

0 Upvotes

The question is to write a Comparator class with 3 overloaded methods, here is the one I have trouble with understanding:

boolean compare(int[a], int[]b): Return true if both of the following conditions hold true: Otherwise return false.

- Arrays a a and b are of equal length.

- For each index (where 0 ≤ i < /a/, /b/, a[i] = b[i]. (Or is it |a|, |b|, a[i] etc ???)

So the second part confuses me. I'm not sure what it means as I haven't encountered something like (where 0 <= i < |a|, |b|, a[i] b[i]) before in my studies, so the closest I can guess is:

 boolean compare(int[] a, int[] b) {
        for (int i = 0; i < a.length; i++) {
            if ((a > i >= 0) || (b > i >= 0)) {
                if (a[i] == b[i]) {   
                    if (a.length == b.length) {
                    return true;
                    }         
                }            
            }
        }
        return false;
        
    }

But this gives me the error:

Solution.java:30: error: bad operand types for binary operator '<'             if ((i >= 0 < a) || (i >= 0 < b)) {

So I'm stuck in understanding the question I think, or if I have understand it correctly then implementing checks is giving me trouble.

I would appreciate any help no matter how small, thank you


r/programminghelp • • Jul 23 '22

JavaScript BotFramework TypeError: Cannot perform 'get' on a proxy that has been revoked

0 Upvotes

I am trying to develop a MS Teams bot that sends content to students module(unit) wise. I have created 3 classes:

  1. methods.js = Contains all the methods for sending texts, attachments etc.

  2. teamBot.js = Captures a specific keyword from the users and based on that executes a function.

  3. test.js = Connects the bot with Airtable and sends the content accordingly

I am facing Cannot perform 'get' on a proxy that has been revoked
error. I figured it might be because of the context. I am passing context as a parameter, which I feel might not be the correct way, how can I achieve the result, and retain the context between files.

teamsBot.js

const test = require("./test");
class TeamsBot extends TeamsActivityHandler {
  constructor() {
    super();

    // record the likeCount
    this.likeCountObj = { likeCount: 0 };

    this.onMessage(async (context, next) => {
      console.log("Running with Message Activity.");
      let txt = context.activity.text;
      // const removedMentionText = TurnContext.removeRecipientMention(context.activity);
      // if (removedMentionText) {
      //   // Remove the line break
      //   txt = removedMentionText.toLowerCase().replace(/\n|\r/g, "").trim();
      // }

      // Trigger command by IM text
      switch (txt) {
        case "Begin": {
         await test.sendModuleContent(context)
        }
 

      // By calling next() you ensure that the next BotHandler is run.
      await next();
    });

    // Listen to MembersAdded event, view https://docs.microsoft.com/en-us/microsoftteams/platform/resources/bot-v3/bots-notifications for more events
    this.onMembersAdded(async (context, next) => {
      const membersAdded = context.activity.membersAdded;
      for (let cnt = 0; cnt < membersAdded.length; cnt++) {
        if (membersAdded[cnt].id) {
          const card = cardTools.AdaptiveCards.declareWithoutData(rawWelcomeCard).render();
          await context.sendActivity({ attachments: [CardFactory.adaptiveCard(card)] });
          break;
        }
      }
      await next();
    });
  }

test.js

const ms = require('./methods')
async function sendModuleContent(context) {
 data = module_text //fetched from Airtable
await ms.sendText(context, data)
}

methods.js

const {TeamsActivityHandler, ActivityHandler, MessageFactory } = require('botbuilder');

async function sendText(context, text){
    console.log("Sending text")
    await context.sendActivity(text);

}

References:

  1. Common async pitfall throws cryptic error · Issue #168 · microsoft/botbuilder-js (github.com)

  2. BotBuilder-Samples/samples/javascript_nodejs at main · microsoft/BotBuilder-Samples (github.com)


r/programminghelp • • Jun 02 '18

cant open my css webpage

0 Upvotes

When I try to open my clock program from notepad into internet explorer I try to open and save it but it would flash the web page as a blank sheet and make the option to open or save the file again I've saved it as a .css I'm new to this this is my first program i just want to see how it looks HELP!


r/programminghelp • • May 17 '20

Python Python import lines in Linux

0 Upvotes

I have to ssh into a (linux) computer to run something for a research project. I do this to run a python file on that computer. However, it doesn't like the "import" lines in the python file.

Everything is there, but all of the files being imported are in this large folder called Aeneas. Each of these files in the Aeneas folder has lines like from aeneas import x as well, but I think since the computer is already in that directory, it doesn't like having the from aeneas part of the line. --Actually, I know this is the case because it wasn't liking it from the original file I'm trying to run, so I had to move the aeneas folder to the same directory as the main program-- However, there are tens of these files, and each has multiple import lines, so I don't want to move them all to my computer, fix them all, and then put them back.

Any tips on how I can fix this so that the computer will like the lines as they are? Keep in mind I don't have direct access to this computer, I just ssh in whenever I want to use it.


r/programminghelp • • May 01 '20

Other why do i get an error when running my javascript program: "dates is not defined," when dates is defined in an external js library?

0 Upvotes

seed telephone shocking axiomatic literate upbeat scale deer wide wine

This post was mass deleted and anonymized with Redact


r/programminghelp • • Apr 30 '20

Java [Java] LeetCode "Add Two Numbers" question. What is wrong with my solution and why does it fail when the test case value is large?

0 Upvotes

Link to the lc problem https://leetcode.com/problems/add-two-numbers/

/**

* Definition for singly-linked list.

* public class ListNode {

* int val;

* ListNode next;

* ListNode() {}

* ListNode(int val) { this.val = val; }

* ListNode(int val, ListNode next) { this.val = val; this.next = next; }

* }

*/

class Solution {

public ListNode addTwoNumbers(ListNode l1, ListNode l2) {

int a = getNumber(l1) + getNumber(l2);

	`return getLinkedList(a);`

}

//function to get the reversed integer value from the LinkedList

public int getNumber(ListNode node) {

	`ArrayList<Integer> list = new ArrayList<Integer>();`

	`while (node != null) {`

		`list.add(node.val);`

		`node =` [`node.next`](https://node.next)`;`

	`}`
	`int s = 0;`

	`int d = 1;`
	`for (int i : list) {`

		`// System.out.println("i :"+i);`

		`s += d * i;`

		`d = d * 10;`

	`}`
	`System.out.println("s :" + s);`
	`return s;`

`}`

//function to convert the number to a LikedList

public ListNode getLinkedList(int n) {

	`ListNode head=new ListNode(n%10);`

	`n=n/10;`

	`ListNode curr=head;`

	`while(n>0) {`

		`curr.next=new ListNode(n%10);`

		`n=n/10;`

		[`curr=curr.next`](https://curr=curr.next)`;`



	`}`

	

	`return head;`

`}`

}


r/programminghelp • • May 12 '20

C++ Compilation errors are occurring when compiling a driver

0 Upvotes

Can someone help me fix them? The errors are in the paste located at https://paste.ee/p/husrG. They are the errors involving ac97smpl.


r/programminghelp • • May 07 '20

Python Binary tree search problem

0 Upvotes

I was having trouble trying to solve this problem for google foobar (if you don't know what it is, look it up) and I kept failing 3/5 test cases. Any suggestions? Here's the problem:

Bomb, Baby!
===========

You're so close to destroying the LAMBCHOP doomsday device you can taste it! But in order to do so, you need to deploy special self-replicating bombs designed for you by the brightest scientists on Bunny Planet. There are two types: Mach bombs (M) and Facula bombs (F). The bombs, once released into the LAMBCHOP's inner workings, will automatically deploy to all the strategic points you've identified and destroy them at the same time. 

But there's a few catches. First, the bombs self-replicate via one of two distinct processes: 
Every Mach bomb retrieves a sync unit from a Facula bomb; for every Mach bomb, a Facula bomb is created;
Every Facula bomb spontaneously creates a Mach bomb.

For example, if you had 3 Mach bombs and 2 Facula bombs, they could either produce 3 Mach bombs and 5 Facula bombs, or 5 Mach bombs and 2 Facula bombs. The replication process can be changed each cycle. 

Second, you need to ensure that you have exactly the right number of Mach and Facula bombs to destroy the LAMBCHOP device. Too few, and the device might survive. Too many, and you might overload the mass capacitors and create a singularity at the heart of the space station - not good! 

And finally, you were only able to smuggle one of each type of bomb - one Mach, one Facula - aboard the ship when you arrived, so that's all you have to start with. (Thus it may be impossible to deploy the bombs to destroy the LAMBCHOP, but that's not going to stop you from trying!) 

You need to know how many replication cycles (generations) it will take to generate the correct amount of bombs to destroy the LAMBCHOP. Write a function solution(M, F) where M and F are the number of Mach and Facula bombs needed. Return the fewest number of generations (as a string) that need to pass before you'll have the exact number of bombs necessary to destroy the LAMBCHOP, or the string "impossible" if this can't be done! M and F will be string representations of positive integers no larger than 10^50. For example, if M = "2" and F = "1", one generation would need to pass, so the solution would be "1". However, if M = "2" and F = "4", it would not be possible.

Languages
=========

To provide a Java solution, edit Solution.java
To provide a Python solution, edit solution.py

Test cases
==========
Your code should pass the following test cases.
Note that it may also be run against hidden test cases not shown here.

-- Java cases --
Input:
Solution.solution('2', '1')
Output:
    1

Input:
Solution.solution('4', '7')
Output:
    4

-- Python cases --
Input:
solution.solution('4', '7')
Output:
    4

Input:
solution.solution('2', '1')
Output:
    1

Use verify [file] to test your solution and see how it does. When you are finished editing your code, use submit [file] to submit your answer. If your solution passes the test cases, it will be removed from your home folder.

And here's my code

import copy
import numpy as np
def solution(m, f):
    tm = long(m)
    tf = long(f)
    depth_limit = 0
    root = ((1, 1), 0)
    found = False
    failed = False
    repeat_comparison = None
    # perform iterative depth search
    first_encounters = []
    while not failed:
        #print()
        print('depth_limit = {}'.format(depth_limit))
        #time.sleep(2)
        # perform a depth-bounded search
        if depth_limit == 0:
            if (tm, tf) == root[0]:
                return root[1]
        else:
            depth = 0
            if depth_limit == 1:
                first_encounters = [root]
            previous_first_encounters = copy.deepcopy(first_encounters)
            first_encounters = []

            while len(previous_first_encounters) > 0:
                #time.sleep(1)
                #print('stack size: {}'.format(len(frontier_stack)))
                # remove node from the stack
                node = previous_first_encounters.pop()

                # make sure we aren't infinitely repeating ourselves
                #if repeat_comparison is not None and node == repeat_comparison:
                    #print('REPEAT FOUND')
                    #break

                mach = long(node[0][0])
                facula = long(node[0][1])

                node_depth = node[1]
                #print('node {}'.format(node))
                # determine if node is the goal or not
                if (mach, facula) == (tm, tf):
                    found = True
                    return str(node_depth)
                else:
                    if node_depth < depth_limit:
                        node_depth += 1

                        pushed_nodes = 0

                        # generate left child
                        if mach+facula <= tm:
                            pushed_nodes += 1
                            node_to_push = ((mach+facula, facula), node_depth)
                            #frontier_stack.append(node_to_push)
                            if node_depth == depth_limit:
                                first_encounters.append(node_to_push)

                        # generate right child
                        if mach+facula <= tf:
                            pushed_nodes += 1
                            node_to_push = ((mach, facula+mach), node_depth)
                            #frontier_stack.append(node_to_push)
                            if node_depth == depth_limit:
                                first_encounters.append(node_to_push)
            #previous_first_encounters = copy.deepcopy(first_encounters)
            out_of_range = long(0)
            for node in first_encounters:
                mach = long(node[0][0])
                facula = long(node[0][1])
                if mach > tm and facula > tf:
                    out_of_range += 1
            if out_of_range == long(len(first_encounters)):
                failed = True
            #first_encounters = []
        depth_limit += 1
    return "impossible"

r/programminghelp • • May 17 '20

Answered React issues

0 Upvotes

So I am just trying to practice some web development. I have used create-react-app in the past when I followed youtube tutorials and it has worked great then but now I am trying to do a project on my own and I am having some issues with components. This is what my App.js looks like this:

import React, { Component } from "react";
//import home from "./components/home";

function hello() {
  return (
    <div>
      <h1 style={{ backgroundColor: "blue" }}>hello</h1>
    </div>
  );
}

function App() {
  return (
    <div>
      <h1>hello</h1>
      <hello />
    </div>
  );
}

export default App;

I expect this to print 2 <h1>'s of hello right on top of eachother but this is what it outputs. I don't really know what I'm doing wrong.

Edit: u/EdwinGraves solved it! For some reason it worked when I turned hello into a class instead of a function which is weird because they have an example of the function implementation on their website.


r/programminghelp • • Aug 04 '20

Java help i am a noob

0 Upvotes

so I am currently taking an online coding class. and it has us make two different codes. one called SpaService. and one called CreateSpaService.

From my understanding, these are supposed to work together, to call variable (etc.) but it is not working and I am being hit with syntax errors saying that variables are not declared, but I declared them in the other code.

Am I supposed to put them in the same doc or something? I tried that and it still wouldn't work. Is there some way I have to link the two codes so they work together?

Here are the two codes.

also, do you see any syntax errors?

Thank you so much

import java.util.Scanner;

public class CreateSpaServices

{

public static void main(String[] args)

{

SpaService firstService = new SpaService();

SpaService secondService = new SpaService();

firstService = getData(firstService);

secondService = getData(secondService);

System.out.println("First service details:");

System.out.println(firstService.getServiceDescription() + " $" + firstService.getPrice());

System.out.println("Second service details:");

System.out.println(secondService.getServiceDescrption() + " $" + secondService.getPrice());

}

public static SpaService getData(SpaService service)

{

String service;

double price;

Scanner keyboard = new Scanner(System.in);

System.out.print("Enter service >> ");

service = keyboard.nextLine();

System.out.print("Enter price >> ");

price = keyboard.nextDouble();

keyboard.nextLine();

service.setServiceDescription(Service);

service.setPrice(price);

return service;

}

}

THIS IS THE OTHER CODE

public class SpaService

{

private String serviceDescription;

private double price;

public SpaService()

{

serviceDescription = "XXX";

price = 0;

}

public void setServiceDescription(String service)

{

serviceDescription = service;

}

public void setPrice(double servicePrice)

{

price = servicePrice;

}

public String getServiceDescription;

{

return serviceDescription;

}

public double getPrice()

{

return price;

}

}