Question
-What is the violated object-oriented concept? Fix the problem (not programmatically, you just need to explain how it can be fixed) 1. public class Position{
-What is the violated object-oriented concept? Fix the problem (not programmatically, you just need to explain how it can be fixed) 1. public class Position{ public double latitude; public double longitude; } public class PositionUtility { public static double distance( Position p1, Position p2 ) { // Calculate and return the distance //between the specified positions. } public static double heading(Position p1, Position p2 ) { // Calculate and return the heading // from position p1 to position p2 } }
2. class Flight { String flight_num; String destination; Date departure; Date arrival; String pilot; Flight [] pilot_scheduled_flights; ... }
3. class BankAccount{ String customer; int number; double balance; public BankAccount (String cust, double balance) { } void deposit (double amount){ balance+=amount; } void withdraw (double amount){ balance-=amount; } } class BankApp { pubic static void main (String[] args){ BankAccount acc1 = new BankAccount(toto, 123, 10000); //withdraw acc1.balance = Acc1.balance -100; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started