Question: I want this code to be in C++, Please do it. The code that is attached in picture is in Java. But I want it
I want this code to be in C++, Please do it. The code that is attached in picture is in Java. But I want it in C++. Please soon as possible. URGENT!!!
Output give. Should be same after done in C++. You can have a look at Output as well. Given as picture below also


public class Counter { private int _count; private String _name; public Counter (String name) { _name = name; public void Increment ( ) { _count++; public void ResetCounter() { _count = 0; public String GetName( ) { return _name; public void Setname (String name) { _name = name; public int GetValue() { return _count; public class Clock { private Counter seconds; private Counter minutes; private Counter hours; public Clock() { seconds = new Counter ("seconds") ; minutes = new Counter("minutes") ; hours = new Counter ("hours") ; public void Tick() { seconds . Increment ( ) ; if ( seconds . GetValue( ) == 60) { seconds . ResetCounter ( ); minutes . Increment ( ) ; if (minutes . GetValue() == 60) { minutes . ResetCounter ( ); hours . Increment ( ) ; if (hours . GetValue() == 24) { ResetCounter ( ) ; public void ResetCounter() { seconds . ResetCounter ( ) ; minutes . ResetCounter ( ); hours . ResetCounter ( ) ; public String GetTime( ) { return String. format ("%02d:%02d :%02d", hours . GetValue(), minutes . GetValue( ), seconds . GetValue( ) ); public class MainClass { public static void main(String args) { Clock myClock = new Clock( ); for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
