Programming Assignment
PROGRAM NEEDS TO BE DONE IN C++
A furlong is a module of distance equal to 220 yards (1/8 mile). Write two classes that implement distances in the following manner:
The first class keeps track of distances as a whole number of furlongs, a whole number of yards, and a number of feet, which may have a fractional component.
The second class keeps track of distances as a whole number of kilometers, followed by a number of meters, which may have a fractional component.
Implement conversions between the two classes, ensuring that conversion in both directions is possible.
Allow the user to enter in the two types of distances and then display the conversions for each entry:
Note that the internal view of the data is entirely up to you, but the logical view must match the specifications above. Also note that the emphasis of this assignment is on the use of conversions. Exhaustive implementations of these classes are therefore not required. The ability to declare, output, and convert constitute the essential elements. The program should still consist of at least three modules.
Submit your source code as attachments to the drop box for this module's programming assignment. You can find the drop box at the end of this module's tab page. Do not compress your attachments. Please review the requirements for submitting on the course syllabus.
Algorithm:
#include<iostream>
using namespace std;
int main () {
//i defined a exit=0 named variable to
iterate the program again and again by a while loop until exit=1
happens.
int exit = 0 ;
while(exit == 0) {
cout<<"\\\\\\\\\\\\\\\\\\enter 0 to
exit\\\\\\\\\\\\\\\\\\\\"<<endl;
cout<<"\n\n1)
Furlong-yeards-feet\n2) kilometer-meter\n\n\n"<<"Choose Unit
System: ";
int number_system;
cin>>number_system;
float
furlong=0,yards=0,feet=0,km=0,m=0,total=0;
if(number_system == 1) {
//taking inputs as furlongs yards and feet.
cout<<"\n\nEnter Furlongs:\t";
cin>>furlong;
cout<<"Enter yards:\t";
cin>>yards;
cout<<"Enter feet:\t";
cin>>feet;
//summing
total in meter.
total =
furlong*201 + yards*0.9144 + feet*0.3048 ;
km = (int)(total
/1000);
m = total -
km*1000 ;
cout<<endl<<endl;
cout<<"Furlong: "<<furlong<<" Yard:
"<<yards<<" Feet: "<<feet<<"\n\n";
cout<<"Kilometer: "<<km<<" Meter:
"<<m<<endl;
}
else if(number_system == 2){
//taking input as km m.
cout<<"\n\nEnter Km:\t";
cin>>km;
cout<<"Enter m:\t";
cin>>m;
//summing total in feet.
total =
km*3280.84 + m*3.28084 ;
furlong =
(int)(total/660.001) ;
yards =
(int)((total - furlong*660.001)/3) ;
feet = (total -
furlong*660.001 - yards*3);
cout<<endl<<endl;
cout<<"Furlong: "<<furlong<<" Yard:
"<<yards<<" Feet: "<<feet<<"\n\n";
cout<<"Kilometer: "<<km<<" Meter:
"<<m<<endl;
}
else if (number_system == 0)
{
exit = 1;
}
else {
cout<<"select valid option\n\n";
}
}
return 0;
}
Programming Assignment PROGRAM NEEDS TO BE DONE IN C++ A furlong is a module of distance...
Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...
GUI Programming Creating a Kilometer to Miles Converter Lab Assignment Objectives Understand the basics of tkinter GUI development. Based on an informal application specification be able to develop a tkinter GUI program that contains one or more Label widgets. Be able to prompt user for input to a GUI application using a messagebox. Obtain user input into a GUI application that can be used for event driven selection. Be able to develop a tkinter GUI program that supports event-based widgets....
Programming Assignment 6 Write a Java program that will implement a simple appointment book. The program should have three classes: a Date class, an AppointmentBook class, and a Driver class. • You will use the Date class that is provided on Blackboard (provided in New Date Class example). • The AppointmentBook class should have the following: o A field for descriptions for the appointments (i.e. Doctor, Hair, etc.). This field should be an array of String objects. o A field...
Programming Assignment Objective Write a Java program that utilizes multiple classes. Write a Java program that utilizes inheritance in a practical manner. Problem: Quiz Bowl Your high school quiz bowl team has been losing its edge and needs to find a method to improve. Knowing that you are a savvy programmer, your coach asks you to write a program that the team members can use to hone their skills. Quiz Bowl questions come in three varieties: True/False Multiple Choice (variable...
Write java program
The purpose of this assignment is to practice OOP with Array and Arraylist, Class design, Interfaces and Polymorphism. Create a NetBeans project named HW3_Yourld. Develop classes for the required solutions. Important: Apply good programming practices Use meaningful variable and constant names. Provide comment describing your program purpose and major steps of your solution. Show your name, university id and section number as a comment at the start of each class. Submit to Moodle a compressed folder of...
ELEN 1301 Programming Assignment #5. Purpose of the program : Calculating class grade percentage. Section 1 : Enter the number of classes you attended (0 ~ 12) 5%. Section 2 : Enter the discussion board score you earned (0 ~ 120) 5%. Section 3 : Enter the quiz score you earned (0 ~ 240) 10%. Section 4 : Enter the programming assignment score you earned (0 ~ 120) 20%. Section 5 : Enter the midterm exam score you earned (0...
LAB 7-Movie List Program Goali Your assignment is to write a C++program to implement the ADT List by creating a list of movies. This assignment will help you practice: multiple file programming, classes, pablic and private methods, dynamie memory, constructors and destructors, arrays and files Implementation the required classes This lab assignment gives you the opportunity to practice creating classes and using dynamic memory in one of There are two classes to implement: Movie and MovieList. As you can see...
Objective: To implement the programming languages features discussed in class and to develop a program that uses Graphical User Interfaces (GUI) that provides a friendly environment for users. Project Assignment Design and implement a Hotel Reservation System. The hotel has two types of rooms. One is regular room that has two beds. Another is deluxe room that has two beds and a safe. The regular room price is $120 per night. The deluxe room is $130 per night. A safe...
Language: C# In this assignment we are going to convert weight and height. So, the user will have the ability to convert either weight or height and as many times as they want. There conversions will only be one way. By that I mean that you will only convert Pounds to Kilograms and Feet and Inches to Centimeters. NOT the other direction (i.e. to Pounds). There will be 3 options that do the conversion, one for each type of loop....
CMSC 256 – Project 5 Programming Assignment 5 Note: When you turn in an assignment to be graded in this class, you are making the claim that you neither gave nor received assistance on the work you turned in (except, of course, assistance from the instructor or teaching assistants). Program: Ticketing System Points: 100 A set of classes is used to handle the different ticket types for a theater event. All tickets have a unique serial number that is assigned...