CodeGym
Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Start learning now
  • All questions
Sanjay Chauhan
Level 28
Delhi
  • 14.04.2020
  • 892views
  • 2comments

failed to meet last two requirement.

Question about the task MVC (part 4)
Java Multithreading,  Level 4,  Lesson 14
Resolved

It's time to replace our fake Model with a real one that receives data from the DataSource.
I've added a service for working with users to the model.service package.
You'll also find a Util utility class in the root of this task.

1. Create a MainModel by analogy with FakeModel.

2. Because the Model accesses services, create and initialize a UserService userService field in MainModel.

3. Implement the loadUsers method:
3.1. Get all users between levels 1 and 100. (Use the getUsersBetweenLevels(1, 100) method.)
3.2. Put all of the users into dataModel.

4. Update Solution.main: replace FakeModel with MainModel.
An advantage of MVC is that it's easy to replace any part of the pattern at any time.

Requirements:
  • A MainModel class that implements the Model interface must be created inside the model package.
  • A private DataModel dataModel field must be created and initialized in the MainModel class.
  • A private UserService userService field must be created and initialized in the MainModel class.
  • You must implement the getDataModel method in the MainModel class.
  • The MainModel class's loadUsers method must be implemented according to the task conditions.
  • You must create a MainModel object instead of a FakeModel object in the Solution class's main method.
package com.codegym.task.task36.task3608; import com.codegym.task.task36.task3608.controller.Controller; import com.codegym.task.task36.task3608.model.MainModel; import com.codegym.task.task36.task3608.model.Model; import com.codegym.task.task36.task3608.view.UsersView; public class Solution { public static void main(String[] args) { Model model = new MainModel(); UsersView usersView = new UsersView(); Controller controller = new Controller(); usersView.setController(controller); controller.setModel(model); controller.setUsersView(usersView); usersView.fireShowAllUsersEvent(); } }
0
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Sanjay Chauhan
Level 28 , Delhi, India
16 April 2020, 04:05solution
Missed to implement this requirement: - A private UserService userService field must be created and initialized in the MainModel class.
private UserService userService = new UserServiceImpl();
+6
Henrique
Level 41 , São Paulo, Brazil
31 July 2020, 16:58
Thanks!!
0
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning and Java developer’s career.
Follow us
Interface language
Programmers Are Made, Not Born © 2023 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2023 CodeGym
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.