Results 1 to 2 of 2

Thread: Designing appropriate classes

  1. #1
    Join Date
    Sep 2020
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Designing appropriate classes

    Good day,

    Can someone please assist me with the following questions:

    1. Create a console application to handle graph details. Considering the required functionality that is required
    and OOP design principles (avoiding anti-patterns and having minimal redundant code), create and
    implement the appropriate classes necessary to achieve the following.
    ? A node in the graph would be made up of a label (the name of the node), an (x, y) coordinate indicating
    its position, and an indication of its shape. Provide all the necessary getters and setters.
    ? The application should include a list of nodes.
    ? The application should also have a list of paths where the user can add paths between labelled nodes
    indicating the type of path (for example, --, ->, <->, or <-). It is clearly necessary to check that the
    labels exist before adding a path between them.
    ? The application should be able to output to the console a list of paths in the following format:
    a [Square at (1, 1)] -> b [Circle at (5, 5)]
    ? Test your solution by creating some nodes, adding them to the list of nodes, and then adding some
    paths (some acceptable, some not). Finally, display the path list.

    2. This question focusses on the concepts of reflection and meta-objects.
    Extend the application you wrote in question 1 by fully serialising the node and path lists. Note the following
    requirements.
    ? Both writer and reader parts of the Serializer should be implemented, serialising to a single file.
    ? Any text-based file format may be used.
    ? When writing, use reflection and the meta-objects as far as possible.
    ? When reading, the various lists should re-created and the data displayed again (to confirm that the
    data was successfully serialised).

    3. Rewrite the InputForm class in Chapter 14 to include an additional QLineEdit to enter a student
    number. A QRegExpValidator should be attached to this QLineEdit so that it only allows a user to
    enter a single, uppercase alphabetic character, followed by a 4 or 5 digit number that does not begin with
    a 0. The result of the computation should be displayed in a QMessageBox with the student number
    (Example: ‘Total Pay for the student S5666 is 183.75’) instead of displaying the message on the input
    interface.

    4. Write a file system browser that allows a user to do the following:
    ? Use the QFileSystemModel to model the directory structure on your computer.
    ? Browse the file/folder structure (using a QTreeView)
    ? Display the following information on any file/folder clicked on: name, path, size (for files), and whether
    it is a file or a folder.
    Create a folder (using a ‘New folder’ button) as a sub-directory in the selected directory
    ? Rename an existing file/directory (using the inherent ability of the model class)
    ? Delete a file/directory (using a ‘Delete’ button) – ensure that you check whether the file/folder should
    be deleted, and also ensure that the information displayed remains current once the file/folder has
    been deleted.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Designing appropriate classes

    Can someone please assist me with the following questions
    No, I think you should learn to solve your homework problems on your own instead of posting the assignment here and expecting us to do your homework for you.

    Some suggestions:

    Problem 1: Since it is a console app, you do not need any user interface other than command line input and output. So stdin / stdout or cin / cout will work. You'll need to define some commands the user can type to display the list of node and edges, etc. You will likely want to implement a Node and an Edge class. The problem doesn't state whether the graph is allowed to have cycles (nodes connected by edges that form a loop). If it does, you will need to make sure you don't get stuck in an infinite loop as you traverse the graph printing nodes and edges.

    Problem 2: Use XML. Qt has a QDomDocument architecture for this.

    Problem 3: There are plenty of examples in the Qt distribution that show how to use all of these classes.

    Problem 4: Likewise.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 11th March 2011, 17:51
  2. Designing transaction in the code equals designing problems
    By kornicameister in forum Qt Programming
    Replies: 8
    Last Post: 3rd February 2011, 02:11
  3. Designing the app
    By TSeierstad in forum Newbie
    Replies: 6
    Last Post: 8th October 2009, 18:06
  4. Designing Multithreaded app in Qt
    By summer_of_69 in forum Qt Programming
    Replies: 3
    Last Post: 18th June 2009, 16:46
  5. designing in qt3
    By deekayt in forum Newbie
    Replies: 9
    Last Post: 1st June 2006, 17:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.