Latest Community Center Posts

import java.util.Scanner;

 class Room_Dimension
{

    private double length;
    private double width;

    public Room_Dimension(double length, double width) 
    {
        this.length = length;
        this.width = width;
    }

    public void setLength(double length) 
    {
    this.length = length;
    }

    public void setWidth(double width) 
    {
    this.width = width;
    }

    public double getLength() 
    {
        return length;
    }

    public double getWidth() 
    {
        return width;
    }

    public Room_Dimension(Room_Dimension roomDimensions)
    {
        this.length = roomDimensions.getLength();
        this.width  = roomDimensions.getWidth();
    }

    public double getArea() 
    {
        return length * width;
    }

}

 class Room_Flooring 
{
    private String floorMaterial;
    private Room_Dimension roomDimensions;
    private double cost_of_material;

    public Room_Flooring(Room_Dimension roomDimensions, String floorMaterial) 
    {
        this.roomDimensions = roomDimensions;
        this.floorMaterial = floorMaterial;
        this.cost_of_material = cost_of_material;
    }

    public Room_Dimension getSize()
    {
        return roomDimensions;
    }

    public void setFloorMaterial(String floorMaterial)
    {
        this.floorMaterial = floorMaterial;
    }

    public String getFloorMaterial()
    {
        return floorMaterial;
    }

    public double getCost_of_Material(String floorMaterial)
    {
        if (floorMaterial == "NormalTile")
        {
            cost_of_material = 2.0;
        }

        if (floorMaterial == "FancyTile")
        {
            cost_of_material = 4.0;
        }

        return cost_of_material;
    }

    public Room_Flooring(Room_Flooring roomFlooring)
    {
        this.roomDimensions = roomFlooring.roomDimensions;
        this.floorMaterial     = roomFlooring.getFloorMaterial();
        this.cost_of_material = roomFlooring.getCost_of_Material(floorMaterial);
    }

    public double getTotalCost() 
    {
        return (getCost_of_Material(floorMaterial)) * roomDimensions.getArea();
    }

    public String toString()
    {
        return ""+ getTotalCost() +"" ;
    }

}

public class Pricing 
{
    public static void main(String[] args) 
    {
        System.out.print('\u000C');

        Scanner room = new Scanner(System.in);

        // Get the length of the room.
        System.out.println("Enter the length of room: ");
        double length = room.nextDouble();

        // Get the width of the room.
        System.out.println("Enter the width of room: ");
        double width = room.nextDouble();

        System.out.println("Enter the floor material that you want- NormalTile or FancyTile: ");
        String ...

Line 107
getArea is a method in the RoomDimension class, but you try to call it using an instance of RoomFlooring
(and vice-versa for the material costs)

ps
Line 102
your main method is declared as an instance method but it should be static

pps
Java conventions are to use camel case and no underscores for member names, eg roomDimensions, getMaterialCost

guffadi commented: If i make my main method static, it says : non-static variable room flooring cannot be referenced from a static context +0

Thanks to Dani queen, I was also affected by this as well, tried to reset password but the email wasn't sent to me, I contacted her about this and she assisted me instantly. I was about to loose hope in gaining back my Daniweb account. Thank you Dani.

I wonder about line 107. room_flooring is called out but I can't find where that method is in that class.

 /** This code is supposed to take the user input of the length
 and breadth of the room in one class, get the user input of the 
material and cost from the other class and calculate the total cost.*/

import java.util.Scanner;

//My first class
class RoomFlooring
{
private String FloorMaterial;
private double material_cost = 0;

public void setFloorMaterial(String FloorMaterial)
{
System.out.print('\u000C');

// Choosing the floor material
Scanner Floor = new Scanner(System.in);
System.out.println("Choose your floor material: FancyTile or NormalTile: ");

FloorMaterial = Floor.nextLine();
}

 public String getFloorMaterial()
 {
    return FloorMaterial;
}
 // determining the cost according to the floor materials
public void setMaterial_Cost(double material_cost)
 {
 if (FloorMaterial == "FancyTile")
{
    material_cost = 2;
}

else
{
    material_cost = 4;
}

}

public double getMaterial_Cost()
 {
 return material_cost;
}

}
// class to set and get the room dimensions from the user 
class RoomDimensions
{ 

private double length;
private double width;
// getting the length of the room
public void setLength(double length)
{
    Scanner room = new Scanner(System.in);
    System.out.println("Enter the length of the room: ");

    length = room.nextDouble(); 

}
// getting the width of the room
public void setWidth(double width)
{
    Scanner room = new Scanner(System.in);
    System.out.println("Enter the width of the room: ");

    width = room.nextDouble();

}

public double getLength()
{
    return length;
}

public double getWidth()
{
    return width;
}
// calculating the area of the room
public double getArea()
{
    return length*width;
}

}
//Public class that has the main method
public class PriceCalculator
{
 private RoomFlooring room_flooring ;
 private ...

And, of course, a big warm welcome to DaniWeb!

what can i learn from this community?

What Jim said, to which I would only add the zen-like "what is it you are looking for?"

I don't know what kind of response you are expecting. Are we supposed to provide a list of all of the topics covered in the hundreds of thousands of posts? My suggestion is to browse the forum post headers and see. Aside from many very informative articles by our esteemed associate, happygeek, you will also find programming tutorials and code snippets. You will also find answers to questions regarding computer hardware and software whether commercial or home grown.

I am new member on Daniweb. what can i learn from this community?

I used to have one of those. Backups took hours. Double for a backup & verify. During that time the computer was useless. Now I just use disk imaging for my system partition and robocopy for my data partition. And because of shadow copy, I can use my computer during an image creation.

Wow, memories there. The last Colorado drive I helped out on was in the 90's.

Thoughts: For the apps to work your OS should be same as before. And there is a catch 22. How to restore a full back to bare metal?
Tell more about the old and new PC OS.

I'd try Linux but only because long ago it had great support builtin to the OS for these drives.

Yes, no one I know has these any longer since the 1TB USB HDD is less than the cost of your tape drive and tapes for 1TB of backup. Most folk moved away from tape over a decade ago.

I have an HP Colorado 5GB external tape drive to backup to my PC data. As the title says it backs up my data to HP C4429 Data Cartridges, which are little 3 5/8 by 2 7/8 tape cartridges.

I'm looking for someone who is familiar with this system, that can help me out. I had a major disk drive failure on the PC that I always backup, and the software that runs the backup system was on the PC that failed.

I have plenty of backup tapes filled with valuable data, for my business but I cannot retreive the data to put it out to another PC. The reason is, that while I have the original installation CD's, when I install the software on another PC, it can't read the Tapes to restore the data.

I first installed the software on a new disk drive, and tried to restore from the Tape Drive, it couldn't read the data. but when I wrote some data from the new disk drive onto the tape, the software could restore it. HELP!

I'm thinking that the software may have had some updates over the years, and the original CD's can't read the new tapes?

Phil

The tl;dr is

The Facebook–Cambridge Analytica data scandal was a major political scandal in early 2018 when it was revealed that Cambridge Analytica had harvested the personal data of millions of people's Facebook profiles without their consent and used it for political purposes. It has been described as a watershed moment in the public understanding of personal data and precipitated a massive fall in Facebook's stock price and calls for tighter regulation of tech companies' use of data.

Wikipedia

You can find details here. Basically Facebook & election hanky-panky.

Dani 1,700

Sorry, I must have been hiding under a rock. I'm not familiar with Cambridge Analytica??

Dani 1,700

gibberish --> again (as in, "Me again?! You guys are slacking on your word associations.")

I got the Monty Python reference. But that doesn't mean it's not gibberish. I hate slapstick humor.

What we've learned is that there are other Cambridge Analytica's out there.

As RJ noted they learned there is little downside to such use.

I think the only thing they learned is how to prevent getting caught again.

rproffitt commented: If (caught) get hard2catch; +0

This coming Sunday marks the one year anniversary of the Cambridge Analytica scandal story breaking and engulfing Facebook. Does anyone think Facebook, and in particular Zuckerberg himself, have learned anything other than they are both apparently immune from whatever smelly stuff hits the fan?

I'd start this task with research.

This lead me to PyDrive in the first ten results.

runIT.py commented: It was pretty complicated for me as I don't know at all how Python works, so I moved on to Google Apps Script which seemed a little bit easier. +0

Perhaps Trump was right when he said drain the swamp.

It appears that it is all swamp. It would be like trying to get all the mud out of Elbonia (Dilbert reference). In the US, with the exceptions like AOC & Bernie Sanders, they are all either feckless, self-serving toadies, or pawns of big business. Here in Canada we have our own scandal going. We have a format AG who resigned from a high-profile position because she was being pressured from above to do something either illegal or unethical. We can believe her version of events (she has absolutely nothing to gain from her honesty and everything to lose) or we can believe Trudeau & co. who could possibly lose power for a decade if the "truth" comes out.

Tough call. Not.

Hints:

The String class has a method to convert into an array of chars
The Arrays class has a method to sort arrays of chars
The String class has a constructor that takes an array of chars to create a new String.

HG has summed it up succinctly. The bit I agree with most is... "I've given up caring".

It seems very little has happened in terms of domestic policies since Breakshit was announced. Either things have been slipped in during big Breakshit news so that they fly under the radar, or the Conselfservatives have been muted. I really, really hope its the latter.

If nothing else, this whole debacle has exposed many of our politicians to be feckless, self-serving, unprincipled grandstanders. Perhaps Trump was right when he said drain the swamp. Our system seems doomed, but there again, people have short memories.

ddanbe commented: Indeed, Breakshit it is! +0

Hi, how do I sort the string in alphabetical order?

find most occuring character("blablabla")
remove most occuring("aaa")
input: blablabla
output: "aaa"

Could you have perhaps made a typo in the email?

I honestly don't think so, but it's always a slim possibility of course ;-)

Hello,

I don't know too many things of programming, I've barely started with some online courses, but am at the very beginning.

This is what I need to do:

  1. From a folder that contains multiple files I need to copy a particular file.
  2. Paste that particular file in multiple directories.
    Note: These folders / files are on Google Drive.

Is there a way I can do this task using Python? Or is there another way I could do this (not necessarily only with Python)?

Thank you!

Dani 1,700

My question was directed to happygeek who didn't get his emails at all.

When you fill out the form, you're prompted to enter your email, and there is no notification as to if you entered a valid email or not. It simply says that, if a valid user exists with that email address, that user will be emailed. So if you have a typo in the email you enter, you may not realize it and won't receive an email.

In my case, probably not, because

  1. I got the emails, just a few days late
  2. I use a macro (jd plus the @) which automatically expands to my email address
Dani 1,700

Could you have perhaps made a typo in the email?

You had me chuckle when you wrote "the next move should be" and this is supposed to be an AI at work. If you feel the result shall be deterministic then you code that up. If you want AI, then if you have Amazon Prime Video watch the AI Video making a cake.
https://www.google.com/search?q=ai+makes+a+cake+this+beast+that+is+the+global+economy

What you have here is probably OK but being AI doesn't mean the outcome is certain. For certainty you code it to do as you wish.